- * modifiers := shift | control | ctrl | meta | alt | altGraph
- *
- * typedID := typed
- *
- * typedKey := string of length 1 giving the Unicode character.
- *
- * pressedReleasedID := (pressed | released)
- *
+ * modifiers := shift | control | ctrl | meta | alt | altGraph
+ * typedID := typed
+ * typedKey := string of length 1 giving the Unicode character.
+ * pressedReleasedID := (pressed | released)
* key := KeyEvent key code name, i.e. the name following "VK_".
*
- * @param s the String which contains key stroke parameters.
*
+ * @param s
+ * the String which contains key stroke parameters.
* @return the AWTKeyStroke for string.
- *
- * @throws IllegalArgumentException if string has incorrect format or null.
+ * @throws IllegalArgumentException
+ * if string has incorrect format or null.
*/
public static AWTKeyStroke getAWTKeyStroke(String s) {
if (s == null) {
@@ -351,16 +392,15 @@ public class AWTKeyStroke implements Serializable {
throw new IllegalArgumentException(Messages.getString("awt.66")); //$NON-NLS-1$
}
- return getAWTKeyStroke(keyChar, keyCode, modifiers,
- release == Boolean.TRUE);
+ return getAWTKeyStroke(keyChar, keyCode, modifiers, release == Boolean.TRUE);
}
/**
* Gets the next token.
*
- * @param tokenizer the tokenizer
- *
- * @return the next token
+ * @param tokenizer
+ * the tokenizer.
+ * @return the next token.
*/
private static String getNextToken(StringTokenizer tokenizer) {
try {
@@ -374,9 +414,9 @@ public class AWTKeyStroke implements Serializable {
/**
* Gets the key code.
*
- * @param s the s
- *
- * @return the key code
+ * @param s
+ * the s.
+ * @return the key code.
*/
static int getKeyCode(String s) {
try {
@@ -394,8 +434,8 @@ public class AWTKeyStroke implements Serializable {
/**
* Gets an instance of the AWTKeyStroke for specified character.
*
- * @param keyChar the keyboard character value.
- *
+ * @param keyChar
+ * the keyboard character value.
* @return a AWTKeyStroke for specified character.
*/
public static AWTKeyStroke getAWTKeyStroke(char keyChar) {
@@ -403,120 +443,121 @@ public class AWTKeyStroke implements Serializable {
}
/**
- * Returns an instance of AWTKeyStroke for a given key code, set
- * of modifiers, and specified key released flag value.
- * The key codes are defined in java.awt.event.KeyEvent class.
- * The set of modifiers is given as a bitwise combination
- * of masks taken from the following list:
+ * Returns an instance of AWTKeyStroke for a given key code, set of
+ * modifiers, and specified key released flag value. The key codes are
+ * defined in java.awt.event.KeyEvent class. The set of modifiers is given
+ * as a bitwise combination of masks taken from the following list:
*
- *
java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
- *
java.awt.event.InputEvent.ALT_DOWN_MASK
- *
java.awt.event.InputEvent.CTRL_DOWN_MASK
- *
java.awt.event.InputEvent.META_DOWN_MASK
- *
java.awt.event.InputEvent.SHIFT_DOWN_MASK
- *
java.awt.event.InputEvent.ALT_GRAPH_MASK
- *
java.awt.event.InputEvent.ALT_MASK
- *
java.awt.event.InputEvent.CTRL_MASK
- *
java.awt.event.InputEvent.META_MASK
- *
java.awt.event.InputEvent.SHIFT_MASK
+ *
java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
+ * java.awt.event.InputEvent.ALT_DOWN_MASK
+ * java.awt.event.InputEvent.CTRL_DOWN_MASK
+ * java.awt.event.InputEvent.META_DOWN_MASK
+ * java.awt.event.InputEvent.SHIFT_DOWN_MASK
+ * java.awt.event.InputEvent.ALT_GRAPH_MASK
+ * java.awt.event.InputEvent.ALT_MASK
+ * java.awt.event.InputEvent.CTRL_MASK
+ * java.awt.event.InputEvent.META_MASK
+ * java.awt.event.InputEvent.SHIFT_MASK
*
- *
- *
- * @param keyCode the specified key code of keyboard.
- * @param modifiers the bit set of modifiers.
+ *
*
+ * @param keyCode
+ * the specified key code of keyboard.
+ * @param modifiers
+ * the bit set of modifiers.
+ * @param onKeyRelease
+ * the value which represents whether this AWTKeyStroke shall
+ * represents a key release.
* @return the AWTKeyStroke.
*/
- public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers,
- boolean onKeyRelease) {
- return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, keyCode, modifiers,
- onKeyRelease);
+ public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers, boolean onKeyRelease) {
+ return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, keyCode, modifiers, onKeyRelease);
}
/**
- * Returns AWTKeyStroke for a specified character and set of modifiers.
- * The set of modifiers is given as a bitwise combination
- * of masks taken from the following list:
+ * Returns AWTKeyStroke for a specified character and set of modifiers. The
+ * set of modifiers is given as a bitwise combination of masks taken from
+ * the following list:
*
- *
java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
- *
java.awt.event.InputEvent.ALT_DOWN_MASK
- *
java.awt.event.InputEvent.CTRL_DOWN_MASK
- *
java.awt.event.InputEvent.META_DOWN_MASK
- *
java.awt.event.InputEvent.SHIFT_DOWN_MASK
- *
java.awt.event.InputEvent.ALT_GRAPH_MASK
- *
java.awt.event.InputEvent.ALT_MASK
- *
java.awt.event.InputEvent.CTRL_MASK
- *
java.awt.event.InputEvent.META_MASK
- *
java.awt.event.InputEvent.SHIFT_MASK
+ *
java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
+ * java.awt.event.InputEvent.ALT_DOWN_MASK
+ * java.awt.event.InputEvent.CTRL_DOWN_MASK
+ * java.awt.event.InputEvent.META_DOWN_MASK
+ * java.awt.event.InputEvent.SHIFT_DOWN_MASK
+ * java.awt.event.InputEvent.ALT_GRAPH_MASK
+ * java.awt.event.InputEvent.ALT_MASK
+ * java.awt.event.InputEvent.CTRL_MASK
+ * java.awt.event.InputEvent.META_MASK
+ * java.awt.event.InputEvent.SHIFT_MASK
*
*
- * @param keyChar the Character object which represents keyboard character value.
- * @param modifiers the bit set of modifiers.
- *
+ * @param keyChar
+ * the Character object which represents keyboard character
+ * value.
+ * @param modifiers
+ * the bit set of modifiers.
* @return the AWTKeyStroke object.
- *
- * @throws IllegalArgumentException if keyChar value is null.
+ * @throws IllegalArgumentException
+ * if keyChar value is null.
*/
public static AWTKeyStroke getAWTKeyStroke(Character keyChar, int modifiers) {
if (keyChar == null) {
// awt.01='{0}' parameter is null
throw new IllegalArgumentException(Messages.getString("awt.01", "keyChar")); //$NON-NLS-1$ //$NON-NLS-2$
}
- return getAWTKeyStroke(keyChar.charValue(), KeyEvent.VK_UNDEFINED,
- modifiers, false);
+ return getAWTKeyStroke(keyChar.charValue(), KeyEvent.VK_UNDEFINED, modifiers, false);
}
/**
- * Returns an instance of AWTKeyStroke for a specified key code and
- * set of modifiers.
- * The key codes are defined in java.awt.event.KeyEvent class.
- * The set of modifiers is given as a bitwise combination
- * of masks taken from the following list:
+ * Returns an instance of AWTKeyStroke for a specified key code and set of
+ * modifiers. The key codes are defined in java.awt.event.KeyEvent class.
+ * The set of modifiers is given as a bitwise combination of masks taken
+ * from the following list:
*
- *
java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
- *
java.awt.event.InputEvent.ALT_DOWN_MASK
- *
java.awt.event.InputEvent.CTRL_DOWN_MASK
- *
java.awt.event.InputEvent.META_DOWN_MASK
- *
java.awt.event.InputEvent.SHIFT_DOWN_MASK
- *
java.awt.event.InputEvent.ALT_GRAPH_MASK
- *
java.awt.event.InputEvent.ALT_MASK
- *
java.awt.event.InputEvent.CTRL_MASK
- *
java.awt.event.InputEvent.META_MASK
- *
java.awt.event.InputEvent.SHIFT_MASK
+ *
java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
+ * java.awt.event.InputEvent.ALT_DOWN_MASK
+ * java.awt.event.InputEvent.CTRL_DOWN_MASK
+ * java.awt.event.InputEvent.META_DOWN_MASK
+ * java.awt.event.InputEvent.SHIFT_DOWN_MASK
+ * java.awt.event.InputEvent.ALT_GRAPH_MASK
+ * java.awt.event.InputEvent.ALT_MASK
+ * java.awt.event.InputEvent.CTRL_MASK
+ * java.awt.event.InputEvent.META_MASK
+ * java.awt.event.InputEvent.SHIFT_MASK
*
- *
- * @param keyCode the specified key code of keyboard.
- * @param modifiers the bit set of modifiers.
*
- * @return the AWTKeyStroke
+ * @param keyCode
+ * the specified key code of keyboard.
+ * @param modifiers
+ * the bit set of modifiers.
+ * @return the AWTKeyStroke.
*/
public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers) {
return getAWTKeyStroke(keyCode, modifiers, false);
}
/**
- * Gets the AWTKeyStroke for a key event. This method obtains the key char
+ * Gets the AWTKeyStroke for a key event. This method obtains the key char
* and key code from the specified key event.
*
- * @param anEvent the key event which identifies the desired AWTKeyStroke.
- *
+ * @param anEvent
+ * the key event which identifies the desired AWTKeyStroke.
* @return the AWTKeyStroke for the key event.
*/
public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent anEvent) {
int id = anEvent.getID();
char undef = KeyEvent.CHAR_UNDEFINED;
- char keyChar = (id == KeyEvent.KEY_TYPED ? anEvent.getKeyChar() :
- undef);
- int keyCode = (keyChar == undef ? anEvent.getKeyCode() :
- KeyEvent.VK_UNDEFINED);
+ char keyChar = (id == KeyEvent.KEY_TYPED ? anEvent.getKeyChar() : undef);
+ int keyCode = (keyChar == undef ? anEvent.getKeyCode() : KeyEvent.VK_UNDEFINED);
return getAWTKeyStroke(keyChar, keyCode, anEvent.getModifiersEx(),
- id == KeyEvent.KEY_RELEASED);
+ id == KeyEvent.KEY_RELEASED);
}
/**
* Gets the key event type for the AWTKeyStroke object.
*
- * @return the key event type: KeyEvent.KEY_PRESSED, KeyEvent.KEY_TYPED, or KeyEvent.KEY_RELEASED
+ * @return the key event type: KeyEvent.KEY_PRESSED, KeyEvent.KEY_TYPED, or
+ * KeyEvent.KEY_RELEASED.
*/
public final int getKeyEventType() {
if (keyCode == KeyEvent.VK_UNDEFINED) {
@@ -526,11 +567,11 @@ public class AWTKeyStroke implements Serializable {
}
/**
- * Retuns true if the key event is associated with the AWTKeyStroke is
- * KEY_RELEASED, overwise false.
+ * Returns true if the key event is associated with the AWTKeyStroke is
+ * KEY_RELEASED, false otherwise.
*
- * @return true, if if the key event associated with the AWTKeyStroke is
- * KEY_RELEASED, overwise false.
+ * @return true, if if the key event associated with the AWTKeyStroke is
+ * KEY_RELEASED, false otherwise.
*/
public final boolean isOnKeyRelease() {
return onKeyRelease;
@@ -539,50 +580,44 @@ public class AWTKeyStroke implements Serializable {
/**
* Read resolve.
*
- * @return the object
- *
- * @throws ObjectStreamException the object stream exception
+ * @return the object.
+ * @throws ObjectStreamException
+ * the object stream exception.
*/
protected Object readResolve() throws ObjectStreamException {
- return getAWTKeyStroke(this.keyChar, this.keyCode,
- this.modifiers, this.onKeyRelease);
+ return getAWTKeyStroke(this.keyChar, this.keyCode, this.modifiers, this.onKeyRelease);
}
/**
* Register subclass.
*
- * @param subclass the subclass
+ * @param subclass
+ * the subclass.
*/
protected static void registerSubclass(Class> subclass) {
- //???AWT
+ // ???AWT
/*
- if (subclass == null) {
- // awt.01='{0}' parameter is null
- throw new IllegalArgumentException(Messages.getString("awt.01", "subclass")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (! AWTKeyStroke.class.isAssignableFrom(subclass)) {
- // awt.67=subclass is not derived from AWTKeyStroke
- throw new ClassCastException(Messages.getString("awt.67")); //$NON-NLS-1$
- }
- try {
- subConstructor = subclass.getDeclaredConstructor();
- subConstructor.setAccessible(true);
- } catch (SecurityException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException e) {
- // awt.68=subclass could not be instantiated
- throw new IllegalArgumentException(Messages.getString("awt.68")); //$NON-NLS-1$
- }
- cache.clear(); //flush the cache
- */
+ * if (subclass == null) { // awt.01='{0}' parameter is null throw new
+ * IllegalArgumentException(Messages.getString("awt.01", "subclass"));
+ * //$NON-NLS-1$ //$NON-NLS-2$ } if (!
+ * AWTKeyStroke.class.isAssignableFrom(subclass)) { // awt.67=subclass
+ * is not derived from AWTKeyStroke throw new
+ * ClassCastException(Messages.getString("awt.67")); //$NON-NLS-1$ } try
+ * { subConstructor = subclass.getDeclaredConstructor();
+ * subConstructor.setAccessible(true); } catch (SecurityException e) {
+ * throw new RuntimeException(e); } catch (NoSuchMethodException e) { //
+ * awt.68=subclass could not be instantiated throw new
+ * IllegalArgumentException(Messages.getString("awt.68")); //$NON-NLS-1$
+ * } cache.clear(); //flush the cache
+ */
}
/**
* Parses the modifier.
*
- * @param strMod the str mod
- *
- * @return the long
+ * @param strMod
+ * the str mod.
+ * @return the long.
*/
private static long parseModifier(String strMod) {
long modifiers = 0l;
@@ -609,9 +644,9 @@ public class AWTKeyStroke implements Serializable {
/**
* Parses the typed id.
*
- * @param strTyped the str typed
- *
- * @return true, if successful
+ * @param strTyped
+ * the str typed.
+ * @return true, if successful.
*/
private static boolean parseTypedID(String strTyped) {
if (strTyped.equals("typed")) { //$NON-NLS-1$
@@ -624,9 +659,9 @@ public class AWTKeyStroke implements Serializable {
/**
* Parses the typed key.
*
- * @param strChar the str char
- *
- * @return the char
+ * @param strChar
+ * the str char.
+ * @return the char.
*/
private static char parseTypedKey(String strChar) {
char keyChar = KeyEvent.CHAR_UNDEFINED;
@@ -642,9 +677,9 @@ public class AWTKeyStroke implements Serializable {
/**
* Parses the pressed released id.
*
- * @param str the str
- *
- * @return the boolean
+ * @param str
+ * the str.
+ * @return the boolean.
*/
private static Boolean parsePressedReleasedID(String str) {
@@ -659,9 +694,9 @@ public class AWTKeyStroke implements Serializable {
/**
* Parses the key.
*
- * @param strCode the str code
- *
- * @return the int
+ * @param strCode
+ * the str code.
+ * @return the int.
*/
private static int parseKey(String strCode) {
int keyCode = KeyEvent.VK_UNDEFINED;
@@ -675,4 +710,3 @@ public class AWTKeyStroke implements Serializable {
return keyCode;
}
}
-
diff --git a/awt/java/awt/AWTPermission.java b/awt/java/awt/AWTPermission.java
index 25326abb1a6b2100a4d61bf65410505b2dd7f7c9..4bd835777d612f467977863a5b7d0f9b2b055097 100644
--- a/awt/java/awt/AWTPermission.java
+++ b/awt/java/awt/AWTPermission.java
@@ -18,24 +18,31 @@
* @author Pavel Dolgov
* @version $Revision$
*/
+
package java.awt;
import java.security.BasicPermission;
/**
- * The AWTPermission specifies the name of the permission and the
- * corresponding action list.
+ * The AWTPermission specifies the name of the permission and the corresponding
+ * action list.
+ *
+ * @since Android 1.0
*/
public final class AWTPermission extends BasicPermission {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = 8890392402588814465L;
/**
* Instantiates a new AWTPermission with defined name and actions.
*
- * @param name the name of a new AWTPermission.
- * @param actions the actions of a new AWTPermission.
+ * @param name
+ * the name of a new AWTPermission.
+ * @param actions
+ * the actions of a new AWTPermission.
*/
public AWTPermission(String name, String actions) {
super(name, actions);
@@ -44,11 +51,11 @@ public final class AWTPermission extends BasicPermission {
/**
* Instantiates a new AWT permission with the defined name.
*
- * @param name the name of a new AWTPermission.
+ * @param name
+ * the name of a new AWTPermission.
*/
public AWTPermission(String name) {
super(name);
}
}
-
diff --git a/awt/java/awt/ActiveEvent.java b/awt/java/awt/ActiveEvent.java
index 41337524a6028927729db5f332e35863dd1c209b..704462390a017c83ecd8d4818071529c8dab0311 100644
--- a/awt/java/awt/ActiveEvent.java
+++ b/awt/java/awt/ActiveEvent.java
@@ -18,18 +18,21 @@
* @author Michael Danilov
* @version $Revision$
*/
+
package java.awt;
/**
- * This interface defines events that know how to dispatch themselves.
- * Such event can be placed upon the event queue and its dispatch method
- * will be called when the event is dispatched.
+ * This interface defines events that know how to dispatch themselves. Such
+ * event can be placed upon the event queue and its dispatch method will be
+ * called when the event is dispatched.
+ *
+ * @since Android 1.0
*/
public interface ActiveEvent {
/**
- * Dispatches the event to the listeners of the event's source,
- * or does whatever it is this event is supposed to do.
+ * Dispatches the event to the listeners of the event's source, or does
+ * whatever it is this event is supposed to do.
*/
public void dispatch();
diff --git a/awt/java/awt/Adjustable.java b/awt/java/awt/Adjustable.java
index 3241cad1dbeba35432f3dc5decb6cc8a9821e6cb..baf80f7c7c6fdb0b8d58927038af4384751e6d1d 100644
--- a/awt/java/awt/Adjustable.java
+++ b/awt/java/awt/Adjustable.java
@@ -18,32 +18,35 @@
* @author Pavel Dolgov
* @version $Revision$
*/
+
package java.awt;
import java.awt.event.AdjustmentListener;
/**
- * The Adjustable interface represents an adjustable numeric value
- * contained within a bounded range of values, such as the current
- * location in scrollable region or the value of a gauge.
+ * The Adjustable interface represents an adjustable numeric value contained
+ * within a bounded range of values, such as the current location in scrollable
+ * region or the value of a gauge.
+ *
+ * @since Android 1.0
*/
public interface Adjustable {
- /**
- * The Constant HORIZONTAL indicates that the Adjustable's orientation
- * is horizontal.
+ /**
+ * The Constant HORIZONTAL indicates that the Adjustable's orientation is
+ * horizontal.
*/
public static final int HORIZONTAL = 0;
- /**
- * The Constant VERTICAL indicates that the Adjustable's orientation
- * is vertical.
+ /**
+ * The Constant VERTICAL indicates that the Adjustable's orientation is
+ * vertical.
*/
public static final int VERTICAL = 1;
- /**
- * The Constant NO_ORIENTATION indicates that the Adjustable
- * has no orientation.
+ /**
+ * The Constant NO_ORIENTATION indicates that the Adjustable has no
+ * orientation.
*/
public static final int NO_ORIENTATION = 2;
@@ -57,14 +60,16 @@ public interface Adjustable {
/**
* Sets the value to the Adjustable object.
*
- * @param a0 the new value of the Adjustable object.
+ * @param a0
+ * the new value of the Adjustable object.
*/
public void setValue(int a0);
/**
* Adds the AdjustmentListener to current Adjustment.
*
- * @param a0 the AdjustmentListener object.
+ * @param a0
+ * the AdjustmentListener object.
*/
public void addAdjustmentListener(AdjustmentListener a0);
@@ -85,7 +90,7 @@ public interface Adjustable {
/**
* Gets the minimum value of the Adjustable.
*
- * @return the minimum value of the Adjustable.
+ * @return the minimum value of the Adjustable.
*/
public int getMinimum();
@@ -113,44 +118,49 @@ public interface Adjustable {
/**
* Removes the adjustment listener of the Adjustable.
*
- * @param a0 the specified AdjustmentListener to be removed.
+ * @param a0
+ * the specified AdjustmentListener to be removed.
*/
public void removeAdjustmentListener(AdjustmentListener a0);
/**
* Sets the block increment for the Adjustable.
*
- * @param a0 the new block increment.
+ * @param a0
+ * the new block increment.
*/
public void setBlockIncrement(int a0);
/**
* Sets the maximum value of the Adjustable.
*
- * @param a0 the new maximum of the Adjustable.
+ * @param a0
+ * the new maximum of the Adjustable.
*/
public void setMaximum(int a0);
/**
* Sets the minimum value of the Adjustable.
*
- * @param a0 the new minimum of the Adjustable.
+ * @param a0
+ * the new minimum of the Adjustable.
*/
public void setMinimum(int a0);
/**
* Sets the unit increment of the Adjustable.
*
- * @param a0 the new unit increment of the Adjustable.
+ * @param a0
+ * the new unit increment of the Adjustable.
*/
public void setUnitIncrement(int a0);
/**
* Sets the visible amount of the Adjustable.
*
- * @param a0 the new visible amount of the Adjustable.
+ * @param a0
+ * the new visible amount of the Adjustable.
*/
public void setVisibleAmount(int a0);
}
-
diff --git a/awt/java/awt/AlphaComposite.java b/awt/java/awt/AlphaComposite.java
index d26753c316a766c9d7ff6fd29890b8fbd5e97bfc..8389eb4621fe21be31d0997fd4a60161a104cf10 100644
--- a/awt/java/awt/AlphaComposite.java
+++ b/awt/java/awt/AlphaComposite.java
@@ -18,6 +18,7 @@
* @author Igor V. Stolyarov
* @version $Revision$
*/
+
package java.awt;
import java.awt.Composite;
@@ -28,148 +29,181 @@ import java.awt.image.ColorModel;
import org.apache.harmony.awt.gl.ICompositeContext;
import org.apache.harmony.awt.internal.nls.Messages;
-
/**
- * The AlphaComposite class defines a basic alpha compositing rules for
- * combining source and destination colors to achieve blending and
- * transparency effects with graphics and images.
+ * The AlphaComposite class defines a basic alpha compositing rules for
+ * combining source and destination colors to achieve blending and transparency
+ * effects with graphics and images.
+ *
+ * @since Android 1.0
*/
public final class AlphaComposite implements Composite {
- /**
- * The Constant CLEAR indicates that both the color and the alpha of
- * the destination are cleared (Porter-Duff Clear rule).
+ /**
+ * The Constant CLEAR indicates that both the color and the alpha of the
+ * destination are cleared (Porter-Duff Clear rule).
*/
public static final int CLEAR = 1;
- /**
- * The Constant SRC indicates that the source is copied to the destination
+ /**
+ * The Constant SRC indicates that the source is copied to the destination
* (Porter-Duff Source rule).
*/
public static final int SRC = 2;
- /** The Constant DST indicates that the destination is left untouched
+ /**
+ * The Constant DST indicates that the destination is left untouched
* (Porter-Duff Destination rule).
*/
public static final int DST = 9;
- /**
- * The Constant SRC_OVER indicates that the source is composited over
- * the destination (Porter-Duff Source Over Destination rule).
+ /**
+ * The Constant SRC_OVER indicates that the source is composited over the
+ * destination (Porter-Duff Source Over Destination rule).
*/
public static final int SRC_OVER = 3;
/**
- * The Constant DST_OVER indicates that The destination is composited over
- * the source and the result replaces the destination
- * (Porter-Duff Destination Over Source rule).
+ * The Constant DST_OVER indicates that The destination is composited over
+ * the source and the result replaces the destination (Porter-Duff
+ * Destination Over Source rule).
*/
public static final int DST_OVER = 4;
/**
- * The Constant SRC_IN indicates that the part of the source lying
- * inside of the destination replaces the destination (Porter-Duff
- * Source In Destination rule).
+ * The Constant SRC_IN indicates that the part of the source lying inside of
+ * the destination replaces the destination (Porter-Duff Source In
+ * Destination rule).
*/
public static final int SRC_IN = 5;
- /**
- * The Constant DST_IN indicates that the part of the destination
- * lying inside of the source replaces the destination
- * (Porter-Duff Destination In Source rule).
+ /**
+ * The Constant DST_IN indicates that the part of the destination lying
+ * inside of the source replaces the destination (Porter-Duff Destination In
+ * Source rule).
*/
public static final int DST_IN = 6;
/**
- * The Constant SRC_OUT indicates that the part of the source lying
- * outside of the destination replaces the destination (Porter-Duff
- * Source Held Out By Destination rule).
+ * The Constant SRC_OUT indicates that the part of the source lying outside
+ * of the destination replaces the destination (Porter-Duff Source Held Out
+ * By Destination rule).
*/
public static final int SRC_OUT = 7;
- /**
- * The Constant DST_OUT indicates that the part of the destination
- * lying outside of the source replaces the destination (Porter-Duff
- * Destination Held Out By Source rule).
+ /**
+ * The Constant DST_OUT indicates that the part of the destination lying
+ * outside of the source replaces the destination (Porter-Duff Destination
+ * Held Out By Source rule).
*/
public static final int DST_OUT = 8;
- /**
- * The Constant SRC_ATOP indicates that the part of the source lying
- * inside of the destination is composited onto the destination
- * (Porter-Duff Source Atop Destination rule).
+ /**
+ * The Constant SRC_ATOP indicates that the part of the source lying inside
+ * of the destination is composited onto the destination (Porter-Duff Source
+ * Atop Destination rule).
*/
public static final int SRC_ATOP = 10;
- /**
- * The Constant DST_ATOP indicates that the part of the destination
- * lying inside of the source is composited over the source and replaces
- * the destination (Porter-Duff Destination Atop Source rule).
+ /**
+ * The Constant DST_ATOP indicates that the part of the destination lying
+ * inside of the source is composited over the source and replaces the
+ * destination (Porter-Duff Destination Atop Source rule).
*/
public static final int DST_ATOP = 11;
/**
- * The Constant XOR indicates that the part of the source that lies
- * outside of the destination is combined with the part of the destination
- * that lies outside of the source (Porter-Duff Source Xor Destination rule).
+ * The Constant XOR indicates that the part of the source that lies outside
+ * of the destination is combined with the part of the destination that lies
+ * outside of the source (Porter-Duff Source Xor Destination rule).
*/
public static final int XOR = 12;
- /** AlphaComposite object with the opaque CLEAR rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque CLEAR rule and an alpha of 1.0f.
+ */
public static final AlphaComposite Clear = new AlphaComposite(CLEAR);
- /** AlphaComposite object with the opaque SRC rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque SRC rule and an alpha of 1.0f.
+ */
public static final AlphaComposite Src = new AlphaComposite(SRC);
- /** AlphaComposite object with the opaque DST rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque DST rule and an alpha of 1.0f.
+ */
public static final AlphaComposite Dst = new AlphaComposite(DST);
- /** AlphaComposite object with the opaque SRC_OVER rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque SRC_OVER rule and an alpha of 1.0f.
+ */
public static final AlphaComposite SrcOver = new AlphaComposite(SRC_OVER);
- /** AlphaComposite object with the opaque DST_OVER rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque DST_OVER rule and an alpha of 1.0f.
+ */
public static final AlphaComposite DstOver = new AlphaComposite(DST_OVER);
- /** AlphaComposite object with the opaque SRC_IN rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque SRC_IN rule and an alpha of 1.0f.
+ */
public static final AlphaComposite SrcIn = new AlphaComposite(SRC_IN);
- /** AlphaComposite object with the opaque DST_IN rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque DST_IN rule and an alpha of 1.0f.
+ */
public static final AlphaComposite DstIn = new AlphaComposite(DST_IN);
- /** AlphaComposite object with the opaque SRC_OUT rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque SRC_OUT rule and an alpha of 1.0f.
+ */
public static final AlphaComposite SrcOut = new AlphaComposite(SRC_OUT);
- /** AlphaComposite object with the opaque DST_OUT rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque DST_OUT rule and an alpha of 1.0f.
+ */
public static final AlphaComposite DstOut = new AlphaComposite(DST_OUT);
- /** AlphaComposite object with the opaque SRC_ATOP rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque SRC_ATOP rule and an alpha of 1.0f.
+ */
public static final AlphaComposite SrcAtop = new AlphaComposite(SRC_ATOP);
- /** AlphaComposite object with the opaque DST_ATOP rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque DST_ATOP rule and an alpha of 1.0f.
+ */
public static final AlphaComposite DstAtop = new AlphaComposite(DST_ATOP);
- /** AlphaComposite object with the opaque XOR rule and an alpha of 1.0f. */
+ /**
+ * AlphaComposite object with the opaque XOR rule and an alpha of 1.0f.
+ */
public static final AlphaComposite Xor = new AlphaComposite(XOR);
- /** The rule. */
+ /**
+ * The rule.
+ */
private int rule;
-
- /** The alpha. */
+
+ /**
+ * The alpha.
+ */
private float alpha;
/**
- * Instantiates a new alpha composite.
- * Creates a context for the compositing operation. The context contains state that is used in performing the compositing operation.
+ * Instantiates a new alpha composite. Creates a context for the compositing
+ * operation. The context contains state that is used in performing the
+ * compositing operation.
*
- * @param rule the rule
- * @param alpha the alpha
+ * @param rule
+ * the rule.
+ * @param alpha
+ * the alpha.
*/
- private AlphaComposite(int rule, float alpha){
- if(rule < CLEAR || rule > XOR) {
+ private AlphaComposite(int rule, float alpha) {
+ if (rule < CLEAR || rule > XOR) {
// awt.11D=Unknown rule
throw new IllegalArgumentException(Messages.getString("awt.11D")); //$NON-NLS-1$
}
- if(alpha < 0.0f || alpha > 1.0f) {
+ if (alpha < 0.0f || alpha > 1.0f) {
// awt.11E=Wrong alpha value
throw new IllegalArgumentException(Messages.getString("awt.11E")); //$NON-NLS-1$
}
@@ -181,41 +215,44 @@ public final class AlphaComposite implements Composite {
/**
* Instantiates a new alpha composite.
*
- * @param rule the rule
+ * @param rule
+ * the rule.
*/
- private AlphaComposite(int rule){
+ private AlphaComposite(int rule) {
this(rule, 1.0f);
}
/**
* Creates a CompositeContext object with the specified source ColorModel,
- * destination ColorModel and RenderingHints parameters for a composing
+ * destination ColorModel and RenderingHints parameters for a composing
* operation.
*
- * @param srcColorModel the source's ColorModel.
- * @param dstColorModel the destination's ColorModel.
- * @param hints the RenderingHints object.
- *
- * @return the CompositeContext object.
- *
- * @see java.awt.Composite#createContext(java.awt.image.ColorModel, java.awt.image.ColorModel, java.awt.RenderingHints)
+ * @param srcColorModel
+ * the source's ColorModel.
+ * @param dstColorModel
+ * the destination's ColorModel.
+ * @param hints
+ * the RenderingHints object.
+ * @return the CompositeContext object.
+ * @see java.awt.Composite#createContext(java.awt.image.ColorModel,
+ * java.awt.image.ColorModel, java.awt.RenderingHints)
*/
- public CompositeContext createContext(ColorModel srcColorModel,
- ColorModel dstColorModel, RenderingHints hints) {
+ public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel,
+ RenderingHints hints) {
return new ICompositeContext(this, srcColorModel, dstColorModel);
}
/**
* Compares the AlphaComposite object with the specified object.
*
- * @param obj the Object to be compared.
- *
+ * @param obj
+ * the Object to be compared.
* @return true, if the AlphaComposite object is equal to the specified
- * object.
+ * object.
*/
@Override
public boolean equals(Object obj) {
- if(!(obj instanceof AlphaComposite)) {
+ if (!(obj instanceof AlphaComposite)) {
return false;
}
AlphaComposite other = (AlphaComposite)obj;
@@ -247,11 +284,11 @@ public final class AlphaComposite implements Composite {
}
/**
- * Gets the alpha value of this AlphaComposite object; returns 1.0 if
- * this AlphaComposite object doesn't have alpha value.
+ * Gets the alpha value of this AlphaComposite object; returns 1.0 if this
+ * AlphaComposite object doesn't have alpha value.
*
- * @return the alpha value of this AlphaComposite object or 1.0 if
- * this AlphaComposite object doesn't have alpha value.
+ * @return the alpha value of this AlphaComposite object or 1.0 if this
+ * AlphaComposite object doesn't have alpha value.
*/
public float getAlpha() {
return alpha;
@@ -260,13 +297,14 @@ public final class AlphaComposite implements Composite {
/**
* Gets the AlphaComposite instance with the specified rule and alpha value.
*
- * @param rule the compositing rule.
- * @param alpha the alpha value.
- *
- * @return AlphaComposite instance.
+ * @param rule
+ * the compositing rule.
+ * @param alpha
+ * the alpha value.
+ * @return the AlphaComposite instance.
*/
public static AlphaComposite getInstance(int rule, float alpha) {
- if(alpha == 1.0f) {
+ if (alpha == 1.0f) {
return getInstance(rule);
}
return new AlphaComposite(rule, alpha);
@@ -275,41 +313,40 @@ public final class AlphaComposite implements Composite {
/**
* Gets the AlphaComposite instance with the specified rule.
*
- * @param rule the compositing rule.
- *
- * @return AlphaComposite instance.
+ * @param rule
+ * the compositing rule.
+ * @return the AlphaComposite instance.
*/
public static AlphaComposite getInstance(int rule) {
- switch(rule){
- case CLEAR:
- return Clear;
- case SRC:
- return Src;
- case DST:
- return Dst;
- case SRC_OVER:
- return SrcOver;
- case DST_OVER:
- return DstOver;
- case SRC_IN:
- return SrcIn;
- case DST_IN:
- return DstIn;
- case SRC_OUT:
- return SrcOut;
- case DST_OUT:
- return DstOut;
- case SRC_ATOP:
- return SrcAtop;
- case DST_ATOP:
- return DstAtop;
- case XOR:
- return Xor;
- default:
- // awt.11D=Unknown rule
- throw new IllegalArgumentException(Messages.getString("awt.11D")); //$NON-NLS-1$
+ switch (rule) {
+ case CLEAR:
+ return Clear;
+ case SRC:
+ return Src;
+ case DST:
+ return Dst;
+ case SRC_OVER:
+ return SrcOver;
+ case DST_OVER:
+ return DstOver;
+ case SRC_IN:
+ return SrcIn;
+ case DST_IN:
+ return DstIn;
+ case SRC_OUT:
+ return SrcOut;
+ case DST_OUT:
+ return DstOut;
+ case SRC_ATOP:
+ return SrcAtop;
+ case DST_ATOP:
+ return DstAtop;
+ case XOR:
+ return Xor;
+ default:
+ // awt.11D=Unknown rule
+ throw new IllegalArgumentException(Messages.getString("awt.11D")); //$NON-NLS-1$
}
}
}
-
diff --git a/awt/java/awt/BasicStroke.java b/awt/java/awt/BasicStroke.java
index 955dc6b3331dc58d90fcd51425957d92cc1441b8..245781570a73b0fe0f1ba62bdb4e2fcc50bf6e81 100644
--- a/awt/java/awt/BasicStroke.java
+++ b/awt/java/awt/BasicStroke.java
@@ -18,6 +18,7 @@
* @author Denis M. Kishenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.geom.GeneralPath;
@@ -27,139 +28,188 @@ import org.apache.harmony.awt.internal.nls.Messages;
import org.apache.harmony.misc.HashCode;
/**
- * The BasicStroke class specifies a set of rendering attributes for the outlines
- * of graphics primitives. The BasicStroke attributes describe the shape of the
- * pen which draws the outline of a Shape and the decorations applied at the ends
- * and joins of path segments of the Shape. The BasicStroke has the following
- * rendering attributes:
+ * The BasicStroke class specifies a set of rendering attributes for the
+ * outlines of graphics primitives. The BasicStroke attributes describe the
+ * shape of the pen which draws the outline of a Shape and the decorations
+ * applied at the ends and joins of path segments of the Shape. The BasicStroke
+ * has the following rendering attributes:
*
*
- *
line width -the pen width which draws the outlines.
- *
end caps - indicates the decoration applied to the ends of unclosed
- * subpaths and dash segments. The BasicStroke defines three different decorations:
- * CAP_BUTT, CAP_ROUND, and CAP_SQUARE.
- *
line joins - indicates the decoration applied at the intersection of
- * two path segments and at the intersection of the endpoints of a subpath.
- * The BasicStroke defines three decorations: JOIN_BEVEL, JOIN_MITER,
- * and JOIN_ROUND.
- *
miter limit - the limit to trim a line join that has a JOIN_MITER
+ *
line width -the pen width which draws the outlines.
+ *
end caps - indicates the decoration applied to the ends of unclosed
+ * subpaths and dash segments. The BasicStroke defines three different
+ * decorations: CAP_BUTT, CAP_ROUND, and CAP_SQUARE.
+ *
line joins - indicates the decoration applied at the intersection of two
+ * path segments and at the intersection of the endpoints of a subpath. The
+ * BasicStroke defines three decorations: JOIN_BEVEL, JOIN_MITER, and
+ * JOIN_ROUND.
+ *
miter limit - the limit to trim a line join that has a JOIN_MITER
* decoration.
- *
dash attributes - the definition of how to make a dash pattern by
- * alternating between opaque and transparent sections
+ *
dash attributes - the definition of how to make a dash pattern by
+ * alternating between opaque and transparent sections
*
+ *
+ *
+ * @since Android 1.0
*/
public class BasicStroke implements Stroke {
- /**
- * The Constant CAP_BUTT indicates the ends of unclosed subpaths
- * and dash segments have no added decoration.
+ /**
+ * The Constant CAP_BUTT indicates the ends of unclosed subpaths and dash
+ * segments have no added decoration.
*/
public static final int CAP_BUTT = 0;
-
- /**
- * The Constant CAP_ROUND indicates the ends of unclosed subpaths
- * and dash segments have a round decoration.
+
+ /**
+ * The Constant CAP_ROUND indicates the ends of unclosed subpaths and dash
+ * segments have a round decoration.
*/
public static final int CAP_ROUND = 1;
-
- /**
- * The Constant CAP_SQUARE indicates the ends of unclosed subpaths
- * and dash segments have a square projection.
+
+ /**
+ * The Constant CAP_SQUARE indicates the ends of unclosed subpaths and dash
+ * segments have a square projection.
*/
public static final int CAP_SQUARE = 2;
- /**
- * The Constant JOIN_MITER indicates that path segments are joined by
+ /**
+ * The Constant JOIN_MITER indicates that path segments are joined by
* extending their outside edges until they meet.
*/
public static final int JOIN_MITER = 0;
-
- /**
- * The Constant JOIN_ROUND indicates that path segments are joined by
+
+ /**
+ * The Constant JOIN_ROUND indicates that path segments are joined by
* rounding off the corner at a radius of half the line width.
*/
public static final int JOIN_ROUND = 1;
-
- /**
- * The Constant JOIN_BEVEL indicates that path segments are joined by
- * connecting the outer corners of their wide outlines with
- * a straight segment.
+
+ /**
+ * The Constant JOIN_BEVEL indicates that path segments are joined by
+ * connecting the outer corners of their wide outlines with a straight
+ * segment.
*/
public static final int JOIN_BEVEL = 2;
-
- /** Constants for calculating. */
- static final int MAX_LEVEL = 20; // Maximal deepness of curve subdivision
-
- /** The Constant CURVE_DELTA. */
- static final double CURVE_DELTA = 2.0; // Width tolerance
-
- /** The Constant CORNER_ANGLE. */
+
+ /**
+ * Constants for calculating.
+ */
+ static final int MAX_LEVEL = 20; // Maximal deepness of curve subdivision
+
+ /**
+ * The Constant CURVE_DELTA.
+ */
+ static final double CURVE_DELTA = 2.0; // Width tolerance
+
+ /**
+ * The Constant CORNER_ANGLE.
+ */
static final double CORNER_ANGLE = 4.0; // Minimum corner angle
-
- /** The Constant CORNER_ZERO. */
+
+ /**
+ * The Constant CORNER_ZERO.
+ */
static final double CORNER_ZERO = 0.01; // Zero angle
-
- /** The Constant CUBIC_ARC. */
+
+ /**
+ * The Constant CUBIC_ARC.
+ */
static final double CUBIC_ARC = 4.0 / 3.0 * (Math.sqrt(2.0) - 1);
- /** Stroke width. */
+ /**
+ * Stroke width.
+ */
float width;
-
- /** Stroke cap type. */
+
+ /**
+ * Stroke cap type.
+ */
int cap;
-
- /** Stroke join type. */
+
+ /**
+ * Stroke join type.
+ */
int join;
-
- /** Stroke miter limit. */
+
+ /**
+ * Stroke miter limit.
+ */
float miterLimit;
-
- /** Stroke dashes array. */
+
+ /**
+ * Stroke dashes array.
+ */
float dash[];
-
- /** Stroke dash phase. */
+
+ /**
+ * Stroke dash phase.
+ */
float dashPhase;
- /** The temporary pre-calculated values. */
+ /**
+ * The temporary pre-calculated values.
+ */
double curveDelta;
-
- /** The corner delta. */
+
+ /**
+ * The corner delta.
+ */
double cornerDelta;
-
- /** The zero delta. */
+
+ /**
+ * The zero delta.
+ */
double zeroDelta;
- /** The w2. */
+ /**
+ * The w2.
+ */
double w2;
-
- /** The fmy. */
+
+ /**
+ * The fmy.
+ */
double fmx, fmy;
-
- /** The smy. */
+
+ /**
+ * The smy.
+ */
double scx, scy, smx, smy;
-
- /** The cy. */
+
+ /**
+ * The cy.
+ */
double mx, my, cx, cy;
- /** The temporary indicators. */
+ /**
+ * The temporary indicators.
+ */
boolean isMove;
-
- /** The is first. */
+
+ /**
+ * The is first.
+ */
boolean isFirst;
-
- /** The check move. */
+
+ /**
+ * The check move.
+ */
boolean checkMove;
-
- /** The temporary and destination work paths. */
+
+ /**
+ * The temporary and destination work paths.
+ */
BufferedPath dst, lp, rp, sp;
-
- /** Stroke dasher class. */
+
+ /**
+ * Stroke dasher class.
+ */
Dasher dasher;
/**
- * Instantiates a new BasicStroke with default width, cap, join, limit,
- * dash attributes parameters. The default parameters are a solid line of
- * width 1.0, CAP_SQUARE, JOIN_MITER, a miter limit of 10.0, null dash attributes,
+ * Instantiates a new BasicStroke with default width, cap, join, limit, dash
+ * attributes parameters. The default parameters are a solid line of width
+ * 1.0, CAP_SQUARE, JOIN_MITER, a miter limit of 10.0, null dash attributes,
* and a dash phase of 0.0f.
*/
public BasicStroke() {
@@ -167,17 +217,24 @@ public class BasicStroke implements Stroke {
}
/**
- * Instantiates a new BasicStroke with the specified width,
- * caps, joins, limit, dash attributes, dash phase parameters.
+ * Instantiates a new BasicStroke with the specified width, caps, joins,
+ * limit, dash attributes, dash phase parameters.
*
- * @param width the width of BasikStroke.
- * @param cap the end decoration of BasikStroke.
- * @param join the join segments decoration.
- * @param miterLimit the limit to trim the miter join.
- * @param dash the array with the dashing pattern.
- * @param dashPhase the offset to start the dashing pattern.
- */
- public BasicStroke(float width, int cap, int join, float miterLimit, float[] dash, float dashPhase) {
+ * @param width
+ * the width of BasikStroke.
+ * @param cap
+ * the end decoration of BasikStroke.
+ * @param join
+ * the join segments decoration.
+ * @param miterLimit
+ * the limit to trim the miter join.
+ * @param dash
+ * the array with the dashing pattern.
+ * @param dashPhase
+ * the offset to start the dashing pattern.
+ */
+ public BasicStroke(float width, int cap, int join, float miterLimit, float[] dash,
+ float dashPhase) {
if (width < 0.0f) {
// awt.133=Negative width
throw new IllegalArgumentException(Messages.getString("awt.133")); //$NON-NLS-1$
@@ -204,7 +261,7 @@ public class BasicStroke implements Stroke {
throw new IllegalArgumentException(Messages.getString("awt.138")); //$NON-NLS-1$
}
ZERO: {
- for(int i = 0; i < dash.length; i++) {
+ for (int i = 0; i < dash.length; i++) {
if (dash[i] < 0.0) {
// awt.139=Negative dash[{0}]
throw new IllegalArgumentException(Messages.getString("awt.139", i)); //$NON-NLS-1$
@@ -226,35 +283,43 @@ public class BasicStroke implements Stroke {
}
/**
- * Instantiates a new BasicStroke with specified width, cap, join, limit
- * and default dash attributes parameters.
+ * Instantiates a new BasicStroke with specified width, cap, join, limit and
+ * default dash attributes parameters.
*
- * @param width the width of BasikStroke.
- * @param cap the end decoration of BasikStroke.
- * @param join the join segments decoration.
- * @param miterLimit the limit to trim the miter join.
+ * @param width
+ * the width of BasikStroke.
+ * @param cap
+ * the end decoration of BasikStroke.
+ * @param join
+ * the join segments decoration.
+ * @param miterLimit
+ * the limit to trim the miter join.
*/
public BasicStroke(float width, int cap, int join, float miterLimit) {
this(width, cap, join, miterLimit, null, 0.0f);
}
/**
- * Instantiates a new BasicStroke with specified width, cap, join
- * and default limit and dash attributes parameters.
+ * Instantiates a new BasicStroke with specified width, cap, join and
+ * default limit and dash attributes parameters.
*
- * @param width the width of BasikStroke.
- * @param cap the end decoration of BasikStroke.
- * @param join the join segments decoration.
+ * @param width
+ * the width of BasikStroke.
+ * @param cap
+ * the end decoration of BasikStroke.
+ * @param join
+ * the join segments decoration.
*/
public BasicStroke(float width, int cap, int join) {
this(width, cap, join, 10.0f, null, 0.0f);
}
/**
- * Instantiates a new BasicStroke with specified width and default cap, join,
- * limit, dash attributes parameters.
+ * Instantiates a new BasicStroke with specified width and default cap,
+ * join, limit, dash attributes parameters.
*
- * @param width the width of BasicStroke.
+ * @param width
+ * the width of BasicStroke.
*/
public BasicStroke(float width) {
this(width, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f);
@@ -288,7 +353,8 @@ public class BasicStroke implements Stroke {
}
/**
- * Gets the miter limit of the BasicStroke (the limit to trim the miter join).
+ * Gets the miter limit of the BasicStroke (the limit to trim the miter
+ * join).
*
* @return the miter limit of the BasicStroke.
*/
@@ -338,10 +404,10 @@ public class BasicStroke implements Stroke {
/**
* Compares this BasicStroke object with the specified Object.
*
- * @param obj the Object to be compared.
- *
- * @return true, if the Object is a BasicStroke with the same data
- * values as this BasicStroke; false otherwise.
+ * @param obj
+ * the Object to be compared.
+ * @return true, if the Object is a BasicStroke with the same data values as
+ * this BasicStroke; false otherwise.
*/
@Override
public boolean equals(Object obj) {
@@ -350,13 +416,9 @@ public class BasicStroke implements Stroke {
}
if (obj instanceof BasicStroke) {
BasicStroke bs = (BasicStroke)obj;
- return
- bs.width == width &&
- bs.cap == cap &&
- bs.join == join &&
- bs.miterLimit == miterLimit &&
- bs.dashPhase == dashPhase &&
- java.util.Arrays.equals(bs.dash, dash);
+ return bs.width == width && bs.cap == cap && bs.join == join
+ && bs.miterLimit == miterLimit && bs.dashPhase == dashPhase
+ && java.util.Arrays.equals(bs.dash, dash);
}
return false;
}
@@ -364,9 +426,9 @@ public class BasicStroke implements Stroke {
/**
* Calculates allowable curve derivation.
*
- * @param width the width
- *
- * @return the curve delta
+ * @param width
+ * the width.
+ * @return the curve delta.
*/
double getCurveDelta(double width) {
double a = width + CURVE_DELTA;
@@ -378,9 +440,9 @@ public class BasicStroke implements Stroke {
/**
* Calculates the value to detect a small angle.
*
- * @param width the width
- *
- * @return the corner delta
+ * @param width
+ * the width.
+ * @return the corner delta.
*/
double getCornerDelta(double width) {
return width * width * Math.sin(Math.PI * CORNER_ANGLE / 180.0);
@@ -389,22 +451,21 @@ public class BasicStroke implements Stroke {
/**
* Calculates value to detect a zero angle.
*
- * @param width the width
- *
- * @return the zero delta
+ * @param width
+ * the width.
+ * @return the zero delta.
*/
double getZeroDelta(double width) {
return width * width * Math.sin(Math.PI * CORNER_ZERO / 180.0);
}
/**
- * Creates a Shape from the outline of the specified shape
- * drawn with this BasicStroke.
- *
- * @param s the specified Shape to be stroked.
+ * Creates a Shape from the outline of the specified shape drawn with this
+ * BasicStroke.
*
+ * @param s
+ * the specified Shape to be stroked.
* @return the Shape of the stroked outline.
- *
* @see java.awt.Stroke#createStrokedShape(java.awt.Shape)
*/
public Shape createStrokedShape(Shape s) {
@@ -429,7 +490,8 @@ public class BasicStroke implements Stroke {
/**
* Generates a shape with a solid (not dashed) outline.
*
- * @param p - the PathIterator of source shape
+ * @param p
+ * the PathIterator of source shape.
*/
void createSolidShape(PathIterator p) {
double coords[] = new double[6];
@@ -439,36 +501,37 @@ public class BasicStroke implements Stroke {
checkMove = true;
boolean isClosed = true;
- while(!p.isDone()) {
- switch(p.currentSegment(coords)) {
- case PathIterator.SEG_MOVETO:
- if (!isClosed) {
- closeSolidShape();
- }
- rp.clean();
- mx = cx = coords[0];
- my = cy = coords[1];
- isMove = true;
- isClosed = false;
- break;
- case PathIterator.SEG_LINETO:
- addLine(cx, cy, cx = coords[0], cy = coords[1], true);
- break;
- case PathIterator.SEG_QUADTO:
- addQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3]);
- break;
- case PathIterator.SEG_CUBICTO:
- addCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5]);
- break;
- case PathIterator.SEG_CLOSE:
- addLine(cx, cy, mx, my, false);
- addJoin(lp, mx, my, lp.xMove, lp.yMove, true);
- addJoin(rp, mx, my, rp.xMove, rp.yMove, false);
- lp.closePath();
- rp.closePath();
- lp.appendReverse(rp);
- isClosed = true;
- break;
+ while (!p.isDone()) {
+ switch (p.currentSegment(coords)) {
+ case PathIterator.SEG_MOVETO:
+ if (!isClosed) {
+ closeSolidShape();
+ }
+ rp.clean();
+ mx = cx = coords[0];
+ my = cy = coords[1];
+ isMove = true;
+ isClosed = false;
+ break;
+ case PathIterator.SEG_LINETO:
+ addLine(cx, cy, cx = coords[0], cy = coords[1], true);
+ break;
+ case PathIterator.SEG_QUADTO:
+ addQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3]);
+ break;
+ case PathIterator.SEG_CUBICTO:
+ addCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4],
+ cy = coords[5]);
+ break;
+ case PathIterator.SEG_CLOSE:
+ addLine(cx, cy, mx, my, false);
+ addJoin(lp, mx, my, lp.xMove, lp.yMove, true);
+ addJoin(rp, mx, my, rp.xMove, rp.yMove, false);
+ lp.closePath();
+ rp.closePath();
+ lp.appendReverse(rp);
+ isClosed = true;
+ break;
}
p.next();
}
@@ -492,7 +555,8 @@ public class BasicStroke implements Stroke {
/**
* Generates dashed stroked shape.
*
- * @param p - the PathIterator of source shape
+ * @param p
+ * the PathIterator of source shape.
*/
void createDashedShape(PathIterator p) {
double coords[] = new double[6];
@@ -502,52 +566,53 @@ public class BasicStroke implements Stroke {
checkMove = false;
boolean isClosed = true;
- while(!p.isDone()) {
- switch(p.currentSegment(coords)) {
- case PathIterator.SEG_MOVETO:
+ while (!p.isDone()) {
+ switch (p.currentSegment(coords)) {
+ case PathIterator.SEG_MOVETO:
- if (!isClosed) {
- closeDashedShape();
- }
+ if (!isClosed) {
+ closeDashedShape();
+ }
- dasher = new Dasher(dash, dashPhase);
- lp.clean();
- rp.clean();
- sp = null;
- isFirst = true;
- isMove = true;
- isClosed = false;
- mx = cx = coords[0];
- my = cy = coords[1];
- break;
- case PathIterator.SEG_LINETO:
- addDashLine(cx, cy, cx = coords[0], cy = coords[1]);
- break;
- case PathIterator.SEG_QUADTO:
- addDashQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3]);
- break;
- case PathIterator.SEG_CUBICTO:
- addDashCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5]);
- break;
- case PathIterator.SEG_CLOSE:
- addDashLine(cx, cy, cx = mx, cy = my);
-
- if (dasher.isConnected()) {
- // Connect current and head segments
- addJoin(lp, fmx, fmy, sp.xMove, sp.yMove, true);
- lp.join(sp);
- addJoin(lp, fmx, fmy, rp.xLast, rp.yLast, true);
- lp.combine(rp);
- addCap(lp, smx, smy, lp.xMove, lp.yMove);
- lp.closePath();
- dst.append(lp);
+ dasher = new Dasher(dash, dashPhase);
+ lp.clean();
+ rp.clean();
sp = null;
- } else {
- closeDashedShape();
- }
+ isFirst = true;
+ isMove = true;
+ isClosed = false;
+ mx = cx = coords[0];
+ my = cy = coords[1];
+ break;
+ case PathIterator.SEG_LINETO:
+ addDashLine(cx, cy, cx = coords[0], cy = coords[1]);
+ break;
+ case PathIterator.SEG_QUADTO:
+ addDashQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3]);
+ break;
+ case PathIterator.SEG_CUBICTO:
+ addDashCubic(cx, cy, coords[0], coords[1], coords[2], coords[3],
+ cx = coords[4], cy = coords[5]);
+ break;
+ case PathIterator.SEG_CLOSE:
+ addDashLine(cx, cy, cx = mx, cy = my);
- isClosed = true;
- break;
+ if (dasher.isConnected()) {
+ // Connect current and head segments
+ addJoin(lp, fmx, fmy, sp.xMove, sp.yMove, true);
+ lp.join(sp);
+ addJoin(lp, fmx, fmy, rp.xLast, rp.yLast, true);
+ lp.combine(rp);
+ addCap(lp, smx, smy, lp.xMove, lp.yMove);
+ lp.closePath();
+ dst.append(lp);
+ sp = null;
+ } else {
+ closeDashedShape();
+ }
+
+ isClosed = true;
+ break;
}
p.next();
}
@@ -583,11 +648,16 @@ public class BasicStroke implements Stroke {
/**
* Adds cap to the work path.
*
- * @param p - the BufferedPath object of work path
- * @param x0 - the x coordinate of the source path
- * @param y0 - the y coordinate on the source path
- * @param x2 - the x coordinate of the next point on the work path
- * @param y2 - the y coordinate of the next point on the work path
+ * @param p
+ * the BufferedPath object of work path.
+ * @param x0
+ * the x coordinate of the source path.
+ * @param y0
+ * the y coordinate on the source path.
+ * @param x2
+ * the x coordinate of the next point on the work path.
+ * @param y2
+ * the y coordinate of the next point on the work path.
*/
void addCap(BufferedPath p, double x0, double y0, double x2, double y2) {
double x1 = p.xLast;
@@ -597,42 +667,49 @@ public class BasicStroke implements Stroke {
double x20 = x2 - x0;
double y20 = y2 - y0;
- switch(cap) {
- case CAP_BUTT:
- p.lineTo(x2, y2);
- break;
- case CAP_ROUND:
- double mx = x10 * CUBIC_ARC;
- double my = y10 * CUBIC_ARC;
-
- double x3 = x0 + y10;
- double y3 = y0 - x10;
-
- x10 *= CUBIC_ARC;
- y10 *= CUBIC_ARC;
- x20 *= CUBIC_ARC;
- y20 *= CUBIC_ARC;
-
- p.cubicTo(x1 + y10, y1 - x10, x3 + mx, y3 + my, x3, y3);
- p.cubicTo(x3 - mx, y3 - my, x2 - y20, y2 + x20, x2, y2);
- break;
- case CAP_SQUARE:
- p.lineTo(x1 + y10, y1 - x10);
- p.lineTo(x2 - y20, y2 + x20);
- p.lineTo(x2, y2);
- break;
+ switch (cap) {
+ case CAP_BUTT:
+ p.lineTo(x2, y2);
+ break;
+ case CAP_ROUND:
+ double mx = x10 * CUBIC_ARC;
+ double my = y10 * CUBIC_ARC;
+
+ double x3 = x0 + y10;
+ double y3 = y0 - x10;
+
+ x10 *= CUBIC_ARC;
+ y10 *= CUBIC_ARC;
+ x20 *= CUBIC_ARC;
+ y20 *= CUBIC_ARC;
+
+ p.cubicTo(x1 + y10, y1 - x10, x3 + mx, y3 + my, x3, y3);
+ p.cubicTo(x3 - mx, y3 - my, x2 - y20, y2 + x20, x2, y2);
+ break;
+ case CAP_SQUARE:
+ p.lineTo(x1 + y10, y1 - x10);
+ p.lineTo(x2 - y20, y2 + x20);
+ p.lineTo(x2, y2);
+ break;
}
}
/**
* Adds bevel and miter join to the work path.
*
- * @param p - the BufferedPath object of work path
- * @param x0 - the x coordinate of the source path
- * @param y0 - the y coordinate on the source path
- * @param x2 - the x coordinate of the next point on the work path
- * @param y2 - the y coordinate of the next point on the work path
- * @param isLeft - the orientation of work path, true if work path lies to the left from source path, false otherwise
+ * @param p
+ * the BufferedPath object of work path.
+ * @param x0
+ * the x coordinate of the source path.
+ * @param y0
+ * the y coordinate on the source path.
+ * @param x2
+ * the x coordinate of the next point on the work path.
+ * @param y2
+ * the y coordinate of the next point on the work path.
+ * @param isLeft
+ * the orientation of work path, true if work path lies to the
+ * left from source path, false otherwise.
*/
void addJoin(BufferedPath p, double x0, double y0, double x2, double y2, boolean isLeft) {
double x1 = p.xLast;
@@ -667,26 +744,26 @@ public class BasicStroke implements Stroke {
p.lineTo(x0, y0);
p.lineTo(x2, y2);
} else {
- switch(join) {
- case JOIN_BEVEL:
- p.lineTo(x2, y2);
- break;
- case JOIN_MITER:
- double s1 = x1 * x10 + y1 * y10;
- double s2 = x2 * x20 + y2 * y20;
- double x3 = (s1 * y20 - s2 * y10) / sin0;
- double y3 = (s2 * x10 - s1 * x20) / sin0;
- double x30 = x3 - x0;
- double y30 = y3 - y0;
- double miterLength = Math.sqrt(x30 * x30 + y30 * y30);
- if (miterLength < miterLimit * w2) {
- p.lineTo(x3, y3);
- }
- p.lineTo(x2, y2);
- break;
- case JOIN_ROUND:
- addRoundJoin(p, x0, y0, x2, y2, isLeft);
- break;
+ switch (join) {
+ case JOIN_BEVEL:
+ p.lineTo(x2, y2);
+ break;
+ case JOIN_MITER:
+ double s1 = x1 * x10 + y1 * y10;
+ double s2 = x2 * x20 + y2 * y20;
+ double x3 = (s1 * y20 - s2 * y10) / sin0;
+ double y3 = (s2 * x10 - s1 * x20) / sin0;
+ double x30 = x3 - x0;
+ double y30 = y3 - y0;
+ double miterLength = Math.sqrt(x30 * x30 + y30 * y30);
+ if (miterLength < miterLimit * w2) {
+ p.lineTo(x3, y3);
+ }
+ p.lineTo(x2, y2);
+ break;
+ case JOIN_ROUND:
+ addRoundJoin(p, x0, y0, x2, y2, isLeft);
+ break;
}
}
}
@@ -694,12 +771,19 @@ public class BasicStroke implements Stroke {
/**
* Adds round join to the work path.
*
- * @param p - the BufferedPath object of work path
- * @param x0 - the x coordinate of the source path
- * @param y0 - the y coordinate on the source path
- * @param x2 - the x coordinate of the next point on the work path
- * @param y2 - the y coordinate of the next point on the work path
- * @param isLeft - the orientation of work path, true if work path lies to the left from source path, false otherwise
+ * @param p
+ * the BufferedPath object of work path.
+ * @param x0
+ * the x coordinate of the source path.
+ * @param y0
+ * the y coordinate on the source path.
+ * @param x2
+ * the x coordinate of the next point on the work path.
+ * @param y2
+ * the y coordinate of the next point on the work path.
+ * @param isLeft
+ * the orientation of work path, true if work path lies to the
+ * left from source path, false otherwise.
*/
void addRoundJoin(BufferedPath p, double x0, double y0, double x2, double y2, boolean isLeft) {
double x1 = p.xLast;
@@ -763,11 +847,16 @@ public class BasicStroke implements Stroke {
/**
* Adds solid line segment to the work path.
*
- * @param x1 - the x coordinate of the start line point
- * @param y1 - the y coordinate of the start line point
- * @param x2 - the x coordinate of the end line point
- * @param y2 - the y coordinate of the end line point
- * @param zero - if true it's allowable to add zero length line segment
+ * @param x1
+ * the x coordinate of the start line point.
+ * @param y1
+ * the y coordinate of the start line point.
+ * @param x2
+ * the x coordinate of the end line point.
+ * @param y2
+ * the y coordinate of the end line point.
+ * @param zero
+ * if true it's allowable to add zero length line segment.
*/
void addLine(double x1, double y1, double x2, double y2, boolean zero) {
double dx = x2 - x1;
@@ -808,12 +897,18 @@ public class BasicStroke implements Stroke {
/**
* Adds solid quad segment to the work path.
*
- * @param x1 - the x coordinate of the first control point
- * @param y1 - the y coordinate of the first control point
- * @param x2 - the x coordinate of the second control point
- * @param y2 - the y coordinate of the second control point
- * @param x3 - the x coordinate of the third control point
- * @param y3 - the y coordinate of the third control point
+ * @param x1
+ * the x coordinate of the first control point.
+ * @param y1
+ * the y coordinate of the first control point.
+ * @param x2
+ * the x coordinate of the second control point.
+ * @param y2
+ * the y coordinate of the second control point.
+ * @param x3
+ * the x coordinate of the third control point.
+ * @param y3
+ * the y coordinate of the third control point.
*/
void addQuad(double x1, double y1, double x2, double y2, double x3, double y3) {
double x21 = x2 - x1;
@@ -841,11 +936,11 @@ public class BasicStroke implements Stroke {
double w;
w = w2 / l21;
- double mx1 = - y21 * w;
- double my1 = x21 * w;
+ double mx1 = -y21 * w;
+ double my1 = x21 * w;
w = w2 / l23;
- double mx3 = y23 * w;
- double my3 = - x23 * w;
+ double mx3 = y23 * w;
+ double my3 = -x23 * w;
double lx1 = x1 + mx1;
double ly1 = y1 + my1;
@@ -903,15 +998,23 @@ public class BasicStroke implements Stroke {
}
/**
- * Subdivides solid quad curve to make outline for source quad segment and adds it to work path.
+ * Subdivides solid quad curve to make outline for source quad segment and
+ * adds it to work path.
*
- * @param x1 - the x coordinate of the first control point
- * @param y1 - the y coordinate of the first control point
- * @param x2 - the x coordinate of the second control point
- * @param y2 - the y coordinate of the second control point
- * @param x3 - the x coordinate of the third control point
- * @param y3 - the y coordinate of the third control point
- * @param level - the maximum level of subdivision deepness
+ * @param x1
+ * the x coordinate of the first control point.
+ * @param y1
+ * the y coordinate of the first control point.
+ * @param x2
+ * the x coordinate of the second control point.
+ * @param y2
+ * the y coordinate of the second control point.
+ * @param x3
+ * the x coordinate of the third control point.
+ * @param y3
+ * the y coordinate of the third control point.
+ * @param level
+ * the maximum level of subdivision deepness.
*/
void addSubQuad(double x1, double y1, double x2, double y2, double x3, double y3, int level) {
double x21 = x2 - x1;
@@ -939,8 +1042,8 @@ public class BasicStroke implements Stroke {
double mx2 = (x21 * l23 + x23 * l21) * w;
double my2 = (y21 * l23 + y23 * l21) * w;
w = w2 / l23;
- double mx3 = y23 * w;
- double my3 = - x23 * w;
+ double mx3 = y23 * w;
+ double my3 = -x23 * w;
lp.quadTo(x2 + mx2, y2 + my2, x3 + mx3, y3 + my3);
rp.quadTo(x2 - mx2, y2 - my2, x3 - mx3, y3 - my3);
}
@@ -949,16 +1052,25 @@ public class BasicStroke implements Stroke {
/**
* Adds solid cubic segment to the work path.
*
- * @param x1 - the x coordinate of the first control point
- * @param y1 - the y coordinate of the first control point
- * @param x2 - the x coordinate of the second control point
- * @param y2 - the y coordinate of the second control point
- * @param x3 - the x coordinate of the third control point
- * @param y3 - the y coordinate of the third control point
- * @param x4 - the x coordinate of the fours control point
- * @param y4 - the y coordinate of the fours control point
- */
- void addCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
+ * @param x1
+ * the x coordinate of the first control point.
+ * @param y1
+ * the y coordinate of the first control point.
+ * @param x2
+ * the x coordinate of the second control point.
+ * @param y2
+ * the y coordinate of the second control point.
+ * @param x3
+ * the x coordinate of the third control point.
+ * @param y3
+ * the y coordinate of the third control point.
+ * @param x4
+ * the x coordinate of the fours control point.
+ * @param y4
+ * the y coordinate of the fours control point.
+ */
+ void addCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4,
+ double y4) {
double x12 = x1 - x2;
double y12 = y1 - y2;
double x23 = x2 - x3;
@@ -997,35 +1109,32 @@ public class BasicStroke implements Stroke {
if (l12 == 0.0) {
w = w2 / l23;
- mx1 = y23 * w;
- my1 = - x23 * w;
+ mx1 = y23 * w;
+ my1 = -x23 * w;
w = w2 / l34;
- mx4 = y34 * w;
- my4 = - x34 * w;
- onLine = - x23 * y34 + y23 * x34 == 0.0; // sin3
- } else
- if (l34 == 0.0) {
+ mx4 = y34 * w;
+ my4 = -x34 * w;
+ onLine = -x23 * y34 + y23 * x34 == 0.0; // sin3
+ } else if (l34 == 0.0) {
w = w2 / l12;
- mx1 = y12 * w;
- my1 = - x12 * w;
+ mx1 = y12 * w;
+ my1 = -x12 * w;
w = w2 / l23;
- mx4 = y23 * w;
- my4 = - x23 * w;
- onLine = - x12 * y23 + y12 * x23 == 0.0; // sin2
+ mx4 = y23 * w;
+ my4 = -x23 * w;
+ onLine = -x12 * y23 + y12 * x23 == 0.0; // sin2
} else {
w = w2 / l12;
- mx1 = y12 * w;
- my1 = - x12 * w;
+ mx1 = y12 * w;
+ my1 = -x12 * w;
w = w2 / l34;
- mx4 = y34 * w;
- my4 = - x34 * w;
+ mx4 = y34 * w;
+ my4 = -x34 * w;
if (l23 == 0.0) {
- onLine = - x12 * y34 + y12 * x34 == 0.0;
+ onLine = -x12 * y34 + y12 * x34 == 0.0;
} else {
- onLine =
- - x12 * y34 + y12 * x34 == 0.0 &&
- - x12 * y23 + y12 * x23 == 0.0 && // sin2
- - x23 * y34 + y23 * x34 == 0.0; // sin3
+ onLine = -x12 * y34 + y12 * x34 == 0.0 && -x12 * y23 + y12 * x23 == 0.0 && // sin2
+ -x23 * y34 + y23 * x34 == 0.0; // sin3
}
}
@@ -1063,8 +1172,7 @@ public class BasicStroke implements Stroke {
if (0.0 < t && t < 1.0) {
roots[rc++] = t;
}
- } else
- if (d > 0.0) {
+ } else if (d > 0.0) {
d = Math.sqrt(d);
double z = l12 + l34 - l23 - l23;
double t;
@@ -1087,15 +1195,15 @@ public class BasicStroke implements Stroke {
}
roots[rc++] = 1.0;
- double ax = - x34 - x12 + x23 + x23;
- double ay = - y34 - y12 + y23 + y23;
- double bx = 3.0 * (- x23 + x12);
- double by = 3.0 * (- y23 + y12);
- double cx = 3.0 * (- x12);
- double cy = 3.0 * (- y12);
+ double ax = -x34 - x12 + x23 + x23;
+ double ay = -y34 - y12 + y23 + y23;
+ double bx = 3.0 * (-x23 + x12);
+ double by = 3.0 * (-y23 + y12);
+ double cx = 3.0 * (-x12);
+ double cy = 3.0 * (-y12);
double xPrev = x1;
double yPrev = y1;
- for(int i = 0; i < rc; i++) {
+ for (int i = 0; i < rc; i++) {
double t = roots[i];
double px = t * (t * (t * ax + bx) + cx) + x1;
double py = t * (t * (t * ay + by) + cy) + y1;
@@ -1109,8 +1217,8 @@ public class BasicStroke implements Stroke {
}
xPrev = px;
yPrev = py;
- mx1 = - mx1;
- my1 = - my1;
+ mx1 = -mx1;
+ my1 = -my1;
}
} else {
lp.cubicTo(x2 + mx1, y2 + my1, x3 + mx4, y3 + my4, x4 + mx4, y4 + my4);
@@ -1122,19 +1230,30 @@ public class BasicStroke implements Stroke {
}
/**
- * Subdivides solid cubic curve to make outline for source quad segment and adds it to work path.
+ * Subdivides solid cubic curve to make outline for source quad segment and
+ * adds it to work path.
*
- * @param x1 - the x coordinate of the first control point
- * @param y1 - the y coordinate of the first control point
- * @param x2 - the x coordinate of the second control point
- * @param y2 - the y coordinate of the second control point
- * @param x3 - the x coordinate of the third control point
- * @param y3 - the y coordinate of the third control point
- * @param x4 - the x coordinate of the fours control point
- * @param y4 - the y coordinate of the fours control point
- * @param level - the maximum level of subdivision deepness
- */
- void addSubCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, int level) {
+ * @param x1
+ * the x coordinate of the first control point.
+ * @param y1
+ * the y coordinate of the first control point.
+ * @param x2
+ * the x coordinate of the second control point.
+ * @param y2
+ * the y coordinate of the second control point.
+ * @param x3
+ * the x coordinate of the third control point.
+ * @param y3
+ * the y coordinate of the third control point.
+ * @param x4
+ * the x coordinate of the fours control point.
+ * @param y4
+ * the y coordinate of the fours control point.
+ * @param level
+ * the maximum level of subdivision deepness.
+ */
+ void addSubCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4,
+ double y4, int level) {
double x12 = x1 - x2;
double y12 = y1 - y2;
double x23 = x2 - x3;
@@ -1142,19 +1261,18 @@ public class BasicStroke implements Stroke {
double x34 = x3 - x4;
double y34 = y3 - y4;
- double cos2 = - x12 * x23 - y12 * y23;
- double cos3 = - x23 * x34 - y23 * y34;
- double sin2 = - x12 * y23 + y12 * x23;
- double sin3 = - x23 * y34 + y23 * x34;
- double sin0 = - x12 * y34 + y12 * x34;
- double cos0 = - x12 * x34 - y12 * y34;
-
- if (level < MAX_LEVEL && (sin2 != 0.0 || sin3 != 0.0 || sin0 != 0.0) &&
- (cos2 >= 0.0 || cos3 >= 0.0 || cos0 >= 0.0 ||
- (Math.abs(sin2 / cos2) > curveDelta) ||
- (Math.abs(sin3 / cos3) > curveDelta) ||
- (Math.abs(sin0 / cos0) > curveDelta)))
- {
+ double cos2 = -x12 * x23 - y12 * y23;
+ double cos3 = -x23 * x34 - y23 * y34;
+ double sin2 = -x12 * y23 + y12 * x23;
+ double sin3 = -x23 * y34 + y23 * x34;
+ double sin0 = -x12 * y34 + y12 * x34;
+ double cos0 = -x12 * x34 - y12 * y34;
+
+ if (level < MAX_LEVEL
+ && (sin2 != 0.0 || sin3 != 0.0 || sin0 != 0.0)
+ && (cos2 >= 0.0 || cos3 >= 0.0 || cos0 >= 0.0
+ || (Math.abs(sin2 / cos2) > curveDelta)
+ || (Math.abs(sin3 / cos3) > curveDelta) || (Math.abs(sin0 / cos0) > curveDelta))) {
double cx = (x2 + x3) / 2.0;
double cy = (y2 + y3) / 2.0;
double lx2 = (x2 + x1) / 2.0;
@@ -1177,27 +1295,26 @@ public class BasicStroke implements Stroke {
if (l12 == 0.0) {
w = w2 / l23;
- mx1 = y23 * w;
- my1 = - x23 * w;
+ mx1 = y23 * w;
+ my1 = -x23 * w;
w = w2 / l34;
- mx4 = y34 * w;
- my4 = - x34 * w;
- } else
- if (l34 == 0.0) {
+ mx4 = y34 * w;
+ my4 = -x34 * w;
+ } else if (l34 == 0.0) {
w = w2 / l12;
- mx1 = y12 * w;
- my1 = - x12 * w;
+ mx1 = y12 * w;
+ my1 = -x12 * w;
w = w2 / l23;
- mx4 = y23 * w;
- my4 = - x23 * w;
+ mx4 = y23 * w;
+ my4 = -x23 * w;
} else {
// Common case
w = w2 / l12;
- mx1 = y12 * w;
- my1 = - x12 * w;
+ mx1 = y12 * w;
+ my1 = -x12 * w;
w = w2 / l34;
- mx4 = y34 * w;
- my4 = - x34 * w;
+ mx4 = y34 * w;
+ my4 = -x34 * w;
}
if (sin2 == 0.0) {
@@ -1225,10 +1342,14 @@ public class BasicStroke implements Stroke {
/**
* Adds dashed line segment to the work path.
*
- * @param x1 - the x coordinate of the start line point
- * @param y1 - the y coordinate of the start line point
- * @param x2 - the x coordinate of the end line point
- * @param y2 - the y coordinate of the end line point
+ * @param x1
+ * the x coordinate of the start line point.
+ * @param y1
+ * the y coordinate of the start line point.
+ * @param x2
+ * the x coordinate of the end line point.
+ * @param y2
+ * the y coordinate of the end line point.
*/
void addDashLine(double x1, double y1, double x2, double y2) {
double x21 = x2 - x1;
@@ -1243,12 +1364,12 @@ public class BasicStroke implements Stroke {
double px1, py1;
px1 = py1 = 0.0;
double w = w2 / l21;
- double mx = - y21 * w;
- double my = x21 * w;
+ double mx = -y21 * w;
+ double my = x21 * w;
dasher.init(new DashIterator.Line(l21));
- while(!dasher.eof()) {
+ while (!dasher.eof()) {
double t = dasher.getValue();
scx = x1 + t * x21;
scy = y1 + t * y21;
@@ -1271,28 +1392,27 @@ public class BasicStroke implements Stroke {
addJoin(lp, x1, y1, lx1, ly1, true);
addJoin(rp, x1, y1, rx1, ry1, false);
}
- } else
- if (dasher.isContinue()) {
- double px2 = scx;
- double py2 = scy;
- lp.lineTo(px2 + mx, py2 + my);
- rp.lineTo(px2 - mx, py2 - my);
- if (dasher.close) {
- addCap(lp, px2, py2, rp.xLast, rp.yLast);
- lp.combine(rp);
- if (isFirst) {
- isFirst = false;
- fmx = smx;
- fmy = smy;
- sp = lp;
- lp = new BufferedPath();
- } else {
- addCap(lp, smx, smy, lp.xMove, lp.yMove);
- lp.closePath();
- }
- isMove = true;
+ } else if (dasher.isContinue()) {
+ double px2 = scx;
+ double py2 = scy;
+ lp.lineTo(px2 + mx, py2 + my);
+ rp.lineTo(px2 - mx, py2 - my);
+ if (dasher.close) {
+ addCap(lp, px2, py2, rp.xLast, rp.yLast);
+ lp.combine(rp);
+ if (isFirst) {
+ isFirst = false;
+ fmx = smx;
+ fmy = smy;
+ sp = lp;
+ lp = new BufferedPath();
+ } else {
+ addCap(lp, smx, smy, lp.xMove, lp.yMove);
+ lp.closePath();
}
+ isMove = true;
}
+ }
dasher.next();
}
@@ -1301,12 +1421,18 @@ public class BasicStroke implements Stroke {
/**
* Adds dashed quad segment to the work path.
*
- * @param x1 - the x coordinate of the first control point
- * @param y1 - the y coordinate of the first control point
- * @param x2 - the x coordinate of the second control point
- * @param y2 - the y coordinate of the second control point
- * @param x3 - the x coordinate of the third control point
- * @param y3 - the y coordinate of the third control point
+ * @param x1
+ * the x coordinate of the first control point.
+ * @param y1
+ * the y coordinate of the first control point.
+ * @param x2
+ * the x coordinate of the second control point.
+ * @param y2
+ * the y coordinate of the second control point.
+ * @param x3
+ * the x coordinate of the third control point.
+ * @param y3
+ * the y coordinate of the third control point.
*/
void addDashQuad(double x1, double y1, double x2, double y2, double x3, double y3) {
@@ -1345,7 +1471,7 @@ public class BasicStroke implements Stroke {
dasher.init(new DashIterator.Quad(x1, y1, x2, y2, x3, y3));
- while(!dasher.eof()) {
+ while (!dasher.eof()) {
double t = dasher.getValue();
double dx = t * ax + bx;
double dy = t * ay + by;
@@ -1357,8 +1483,8 @@ public class BasicStroke implements Stroke {
dx1 = dx;
dy1 = dy;
double w = w2 / Math.sqrt(dx1 * dx1 + dy1 * dy1);
- double mx1 = - dy1 * w;
- double my1 = dx1 * w;
+ double mx1 = -dy1 * w;
+ double my1 = dx1 * w;
double lx1 = px1 + mx1;
double ly1 = py1 + my1;
double rx1 = px1 - mx1;
@@ -1374,33 +1500,32 @@ public class BasicStroke implements Stroke {
addJoin(lp, x1, y1, lx1, ly1, true);
addJoin(rp, x1, y1, rx1, ry1, false);
}
- } else
- if (dasher.isContinue()) {
- double px3 = scx;
- double py3 = scy;
- double sx = x2 - x23 * prev;
- double sy = y2 - y23 * prev;
- double t2 = (t - prev) / (1 - prev);
- double px2 = px1 + (sx - px1) * t2;
- double py2 = py1 + (sy - py1) * t2;
-
- addQuad(px1, py1, px2, py2, px3, py3);
- if (dasher.isClosed()) {
- addCap(lp, px3, py3, rp.xLast, rp.yLast);
- lp.combine(rp);
- if (isFirst) {
- isFirst = false;
- fmx = smx;
- fmy = smy;
- sp = lp;
- lp = new BufferedPath();
- } else {
- addCap(lp, smx, smy, lp.xMove, lp.yMove);
- lp.closePath();
- }
- isMove = true;
+ } else if (dasher.isContinue()) {
+ double px3 = scx;
+ double py3 = scy;
+ double sx = x2 - x23 * prev;
+ double sy = y2 - y23 * prev;
+ double t2 = (t - prev) / (1 - prev);
+ double px2 = px1 + (sx - px1) * t2;
+ double py2 = py1 + (sy - py1) * t2;
+
+ addQuad(px1, py1, px2, py2, px3, py3);
+ if (dasher.isClosed()) {
+ addCap(lp, px3, py3, rp.xLast, rp.yLast);
+ lp.combine(rp);
+ if (isFirst) {
+ isFirst = false;
+ fmx = smx;
+ fmy = smy;
+ sp = lp;
+ lp = new BufferedPath();
+ } else {
+ addCap(lp, smx, smy, lp.xMove, lp.yMove);
+ lp.closePath();
}
+ isMove = true;
}
+ }
prev = t;
dasher.next();
@@ -1410,16 +1535,25 @@ public class BasicStroke implements Stroke {
/**
* Adds dashed cubic segment to the work path.
*
- * @param x1 - the x coordinate of the first control point
- * @param y1 - the y coordinate of the first control point
- * @param x2 - the x coordinate of the second control point
- * @param y2 - the y coordinate of the second control point
- * @param x3 - the x coordinate of the third control point
- * @param y3 - the y coordinate of the third control point
- * @param x4 - the x coordinate of the fours control point
- * @param y4 - the y coordinate of the fours control point
+ * @param x1
+ * the x coordinate of the first control point.
+ * @param y1
+ * the y coordinate of the first control point.
+ * @param x2
+ * the x coordinate of the second control point.
+ * @param y2
+ * the y coordinate of the second control point.
+ * @param x3
+ * the x coordinate of the third control point.
+ * @param y3
+ * the y coordinate of the third control point.
+ * @param x4
+ * the x coordinate of the fours control point.
+ * @param y4
+ * the y coordinate of the fours control point.
*/
- void addDashCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
+ void addDashCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4,
+ double y4) {
double x12 = x1 - x2;
double y12 = y1 - y2;
@@ -1469,7 +1603,7 @@ public class BasicStroke implements Stroke {
dasher.init(new DashIterator.Cubic(x1, y1, x2, y2, x3, y3, x4, y4));
- while(!dasher.eof()) {
+ while (!dasher.eof()) {
double t = dasher.getValue();
scx = t * (t * (t * ax + bx) + cx) + dx;
@@ -1480,8 +1614,8 @@ public class BasicStroke implements Stroke {
double dx1 = t * (t * (ax + ax + ax) + bx + bx) + cx;
double dy1 = t * (t * (ay + ay + ay) + by + by) + cy;
double w = w2 / Math.sqrt(dx1 * dx1 + dy1 * dy1);
- double mx1 = - dy1 * w;
- double my1 = dx1 * w;
+ double mx1 = -dy1 * w;
+ double my1 = dx1 * w;
double lx1 = px1 + mx1;
double ly1 = py1 + my1;
double rx1 = px1 - mx1;
@@ -1497,42 +1631,41 @@ public class BasicStroke implements Stroke {
addJoin(lp, x1, y1, lx1, ly1, true);
addJoin(rp, x1, y1, rx1, ry1, false);
}
- } else
- if (dasher.isContinue()) {
- double sx1 = x2 - x23 * prev;
- double sy1 = y2 - y23 * prev;
- double sx2 = x3 - x34 * prev;
- double sy2 = y3 - y34 * prev;
- double sx3 = sx1 + (sx2 - sx1) * prev;
- double sy3 = sy1 + (sy2 - sy1) * prev;
- double t2 = (t - prev) / (1 - prev);
- double sx4 = sx3 + (sx2 - sx3) * t2;
- double sy4 = sy3 + (sy2 - sy3) * t2;
-
- double px4 = scx;
- double py4 = scy;
- double px2 = px1 + (sx3 - px1) * t2;
- double py2 = py1 + (sy3 - py1) * t2;
- double px3 = px2 + (sx4 - px2) * t2;
- double py3 = py2 + (sy4 - py2) * t2;
-
- addCubic(px1, py1, px2, py2, px3, py3, px4, py4);
- if (dasher.isClosed()) {
- addCap(lp, px4, py4, rp.xLast, rp.yLast);
- lp.combine(rp);
- if (isFirst) {
- isFirst = false;
- fmx = smx;
- fmy = smy;
- sp = lp;
- lp = new BufferedPath();
- } else {
- addCap(lp, smx, smy, lp.xMove, lp.yMove);
- lp.closePath();
- }
- isMove = true;
+ } else if (dasher.isContinue()) {
+ double sx1 = x2 - x23 * prev;
+ double sy1 = y2 - y23 * prev;
+ double sx2 = x3 - x34 * prev;
+ double sy2 = y3 - y34 * prev;
+ double sx3 = sx1 + (sx2 - sx1) * prev;
+ double sy3 = sy1 + (sy2 - sy1) * prev;
+ double t2 = (t - prev) / (1 - prev);
+ double sx4 = sx3 + (sx2 - sx3) * t2;
+ double sy4 = sy3 + (sy2 - sy3) * t2;
+
+ double px4 = scx;
+ double py4 = scy;
+ double px2 = px1 + (sx3 - px1) * t2;
+ double py2 = py1 + (sy3 - py1) * t2;
+ double px3 = px2 + (sx4 - px2) * t2;
+ double py3 = py2 + (sy4 - py2) * t2;
+
+ addCubic(px1, py1, px2, py2, px3, py3, px4, py4);
+ if (dasher.isClosed()) {
+ addCap(lp, px4, py4, rp.xLast, rp.yLast);
+ lp.combine(rp);
+ if (isFirst) {
+ isFirst = false;
+ fmx = smx;
+ fmy = smy;
+ sp = lp;
+ lp = new BufferedPath();
+ } else {
+ addCap(lp, smx, smy, lp.xMove, lp.yMove);
+ lp.closePath();
}
+ isMove = true;
}
+ }
prev = t;
dasher.next();
@@ -1543,30 +1676,44 @@ public class BasicStroke implements Stroke {
* Dasher class provides dashing for particular dash style.
*/
class Dasher {
-
- /** The pos. */
+
+ /**
+ * The pos.
+ */
double pos;
-
- /** The first. */
+
+ /**
+ * The first.
+ */
boolean close, visible, first;
-
- /** The dash. */
+
+ /**
+ * The dash.
+ */
float dash[];
-
- /** The phase. */
+
+ /**
+ * The phase.
+ */
float phase;
-
- /** The index. */
+
+ /**
+ * The index.
+ */
int index;
-
- /** The iter. */
+
+ /**
+ * The iter.
+ */
DashIterator iter;
-
+
/**
* Instantiates a new dasher.
*
- * @param dash the dash
- * @param phase the phase
+ * @param dash
+ * the dash.
+ * @param phase
+ * the phase.
*/
Dasher(float dash[], float phase) {
this.dash = dash;
@@ -1578,52 +1725,53 @@ public class BasicStroke implements Stroke {
visible = !visible;
pos -= dash[index];
index = (index + 1) % dash.length;
- }
+ }
pos = -pos;
first = visible;
}
-
+
/**
* Inits the.
*
- * @param iter the iter
+ * @param iter
+ * the iter.
*/
void init(DashIterator iter) {
this.iter = iter;
close = true;
}
-
+
/**
* Checks if is open.
*
- * @return true, if is open
+ * @return true, if is open.
*/
boolean isOpen() {
return visible && pos < iter.length;
}
-
+
/**
* Checks if is continue.
*
- * @return true, if is continue
+ * @return true, if is continue.
*/
boolean isContinue() {
return !visible && pos > 0;
}
-
+
/**
* Checks if is closed.
*
- * @return true, if is closed
+ * @return true, if is closed.
*/
boolean isClosed() {
return close;
}
-
+
/**
* Checks if is connected.
*
- * @return true, if is connected
+ * @return true, if is connected.
*/
boolean isConnected() {
return first && !close;
@@ -1632,7 +1780,7 @@ public class BasicStroke implements Stroke {
/**
* Eof.
*
- * @return true, if successful
+ * @return true, if successful.
*/
boolean eof() {
if (!close) {
@@ -1648,7 +1796,7 @@ public class BasicStroke implements Stroke {
}
return false;
}
-
+
/**
* Next.
*/
@@ -1663,17 +1811,17 @@ public class BasicStroke implements Stroke {
}
visible = !visible;
}
-
+
/**
* Gets the value.
*
- * @return the value
+ * @return the value.
*/
double getValue() {
double t = iter.getNext(pos);
return t < 0 ? 0 : (t > 1 ? 1 : t);
}
-
+
}
/**
@@ -1681,7 +1829,9 @@ public class BasicStroke implements Stroke {
*/
static abstract class DashIterator {
- /** The Constant FLATNESS. */
+ /**
+ * The Constant FLATNESS.
+ */
static final double FLATNESS = 1.0;
/**
@@ -1692,7 +1842,8 @@ public class BasicStroke implements Stroke {
/**
* Instantiates a new line.
*
- * @param len the len
+ * @param len
+ * the len.
*/
Line(double len) {
length = len;
@@ -1710,36 +1861,56 @@ public class BasicStroke implements Stroke {
*/
static class Quad extends DashIterator {
- /** The val size. */
+ /**
+ * The val size.
+ */
int valSize;
-
- /** The val pos. */
+
+ /**
+ * The val pos.
+ */
int valPos;
-
- /** The cur len. */
+
+ /**
+ * The cur len.
+ */
double curLen;
-
- /** The prev len. */
+
+ /**
+ * The prev len.
+ */
double prevLen;
-
- /** The last len. */
+
+ /**
+ * The last len.
+ */
double lastLen;
-
- /** The values. */
+
+ /**
+ * The values.
+ */
double[] values;
-
- /** The step. */
+
+ /**
+ * The step.
+ */
double step;
/**
* Instantiates a new quad.
*
- * @param x1 the x1
- * @param y1 the y1
- * @param x2 the x2
- * @param y2 the y2
- * @param x3 the x3
- * @param y3 the y3
+ * @param x1
+ * the x1.
+ * @param y1
+ * the y1.
+ * @param x2
+ * the x2.
+ * @param y2
+ * the y2.
+ * @param x3
+ * the x3.
+ * @param y3
+ * the y3.
*/
Quad(double x1, double y1, double x2, double y2, double x3, double y3) {
@@ -1766,7 +1937,7 @@ public class BasicStroke implements Stroke {
double pvx = vx;
double pvy = vy;
length = 0.0;
- for(int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++) {
vx += dx1;
vy += dy1;
dx1 += dx2;
@@ -1804,40 +1975,63 @@ public class BasicStroke implements Stroke {
*/
static class Cubic extends DashIterator {
- /** The val size. */
+ /**
+ * The val size.
+ */
int valSize;
-
- /** The val pos. */
+
+ /**
+ * The val pos.
+ */
int valPos;
-
- /** The cur len. */
+
+ /**
+ * The cur len.
+ */
double curLen;
-
- /** The prev len. */
+
+ /**
+ * The prev len.
+ */
double prevLen;
-
- /** The last len. */
+
+ /**
+ * The last len.
+ */
double lastLen;
-
- /** The values. */
+
+ /**
+ * The values.
+ */
double[] values;
-
- /** The step. */
+
+ /**
+ * The step.
+ */
double step;
/**
* Instantiates a new cubic.
*
- * @param x1 the x1
- * @param y1 the y1
- * @param x2 the x2
- * @param y2 the y2
- * @param x3 the x3
- * @param y3 the y3
- * @param x4 the x4
- * @param y4 the y4
+ * @param x1
+ * the x1.
+ * @param y1
+ * the y1.
+ * @param x2
+ * the x2.
+ * @param y2
+ * the y2.
+ * @param x3
+ * the x3.
+ * @param y3
+ * the y3.
+ * @param x4
+ * the x4.
+ * @param y4
+ * the y4.
*/
- Cubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
+ Cubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4,
+ double y4) {
double nx1 = x1 + x3 - x2 - x2;
double ny1 = y1 + y3 - y2 - y2;
@@ -1869,7 +2063,7 @@ public class BasicStroke implements Stroke {
double pvx = vx;
double pvy = vy;
length = 0.0;
- for(int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++) {
vx += dx1;
vy += dy1;
dx1 += dx2;
@@ -1904,15 +2098,17 @@ public class BasicStroke implements Stroke {
}
- /** The length. */
+ /**
+ * The length.
+ */
double length;
/**
* Gets the next.
*
- * @param dashPos the dash pos
- *
- * @return the next
+ * @param dashPos
+ * the dash pos.
+ * @return the next.
*/
abstract double getNext(double dashPos);
@@ -1923,39 +2119,60 @@ public class BasicStroke implements Stroke {
*/
static class BufferedPath {
- /** The Constant bufCapacity. */
+ /**
+ * The Constant bufCapacity.
+ */
private static final int bufCapacity = 10;
- /** The point shift. */
+ /**
+ * The point shift.
+ */
static int pointShift[] = {
- 2, // MOVETO
- 2, // LINETO
- 4, // QUADTO
- 6, // CUBICTO
- 0}; // CLOSE
+ 2, // MOVETO
+ 2, // LINETO
+ 4, // QUADTO
+ 6, // CUBICTO
+ 0
+ }; // CLOSE
- /** The types. */
+ /**
+ * The types.
+ */
byte[] types;
-
- /** The points. */
+
+ /**
+ * The points.
+ */
float[] points;
-
- /** The type size. */
+
+ /**
+ * The type size.
+ */
int typeSize;
-
- /** The point size. */
+
+ /**
+ * The point size.
+ */
int pointSize;
- /** The x last. */
+ /**
+ * The x last.
+ */
float xLast;
-
- /** The y last. */
+
+ /**
+ * The y last.
+ */
float yLast;
-
- /** The x move. */
+
+ /**
+ * The x move.
+ */
float xMove;
-
- /** The y move. */
+
+ /**
+ * The y move.
+ */
float yMove;
/**
@@ -1969,8 +2186,10 @@ public class BasicStroke implements Stroke {
/**
* Check buf.
*
- * @param typeCount the type count
- * @param pointCount the point count
+ * @param typeCount
+ * the type count.
+ * @param pointCount
+ * the point count.
*/
void checkBuf(int typeCount, int pointCount) {
if (typeSize + typeCount > types.length) {
@@ -1988,7 +2207,7 @@ public class BasicStroke implements Stroke {
/**
* Checks if is empty.
*
- * @return true, if is empty
+ * @return true, if is empty.
*/
boolean isEmpty() {
return typeSize == 0;
@@ -2005,8 +2224,10 @@ public class BasicStroke implements Stroke {
/**
* Move to.
*
- * @param x the x
- * @param y the y
+ * @param x
+ * the x.
+ * @param y
+ * the y.
*/
void moveTo(double x, double y) {
checkBuf(1, 2);
@@ -2018,8 +2239,10 @@ public class BasicStroke implements Stroke {
/**
* Line to.
*
- * @param x the x
- * @param y the y
+ * @param x
+ * the x.
+ * @param y
+ * the y.
*/
void lineTo(double x, double y) {
checkBuf(1, 2);
@@ -2031,10 +2254,14 @@ public class BasicStroke implements Stroke {
/**
* Quad to.
*
- * @param x1 the x1
- * @param y1 the y1
- * @param x2 the x2
- * @param y2 the y2
+ * @param x1
+ * the x1.
+ * @param y1
+ * the y1.
+ * @param x2
+ * the x2.
+ * @param y2
+ * the y2.
*/
void quadTo(double x1, double y1, double x2, double y2) {
checkBuf(1, 4);
@@ -2048,12 +2275,18 @@ public class BasicStroke implements Stroke {
/**
* Cubic to.
*
- * @param x1 the x1
- * @param y1 the y1
- * @param x2 the x2
- * @param y2 the y2
- * @param x3 the x3
- * @param y3 the y3
+ * @param x1
+ * the x1.
+ * @param y1
+ * the y1.
+ * @param x2
+ * the x2.
+ * @param y2
+ * the y2.
+ * @param x3
+ * the x3.
+ * @param y3
+ * the y3.
*/
void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) {
checkBuf(1, 6);
@@ -2077,8 +2310,10 @@ public class BasicStroke implements Stroke {
/**
* Sets the last.
*
- * @param x the x
- * @param y the y
+ * @param x
+ * the x.
+ * @param y
+ * the y.
*/
void setLast(double x, double y) {
points[pointSize - 2] = xLast = (float)x;
@@ -2088,7 +2323,8 @@ public class BasicStroke implements Stroke {
/**
* Append.
*
- * @param p the p
+ * @param p
+ * the p.
*/
void append(BufferedPath p) {
checkBuf(p.typeSize, p.pointSize);
@@ -2103,18 +2339,19 @@ public class BasicStroke implements Stroke {
/**
* Append reverse.
*
- * @param p the p
+ * @param p
+ * the p.
*/
void appendReverse(BufferedPath p) {
checkBuf(p.typeSize, p.pointSize);
// Skip last point, beacause it's the first point of the second path
- for(int i = p.pointSize - 2; i >= 0; i -= 2) {
+ for (int i = p.pointSize - 2; i >= 0; i -= 2) {
points[pointSize++] = p.points[i + 0];
points[pointSize++] = p.points[i + 1];
}
// Skip first type, beacuse it's always MOVETO
int closeIndex = 0;
- for(int i = p.typeSize - 1; i >= 0; i--) {
+ for (int i = p.typeSize - 1; i >= 0; i--) {
byte type = p.types[i];
if (type == PathIterator.SEG_MOVETO) {
types[closeIndex] = PathIterator.SEG_MOVETO;
@@ -2133,7 +2370,8 @@ public class BasicStroke implements Stroke {
/**
* Join.
*
- * @param p the p
+ * @param p
+ * the p.
*/
void join(BufferedPath p) {
// Skip MOVETO
@@ -2149,17 +2387,18 @@ public class BasicStroke implements Stroke {
/**
* Combine.
*
- * @param p the p
+ * @param p
+ * the p.
*/
void combine(BufferedPath p) {
checkBuf(p.typeSize - 1, p.pointSize - 2);
// Skip last point, beacause it's the first point of the second path
- for(int i = p.pointSize - 4; i >= 0; i -= 2) {
+ for (int i = p.pointSize - 4; i >= 0; i -= 2) {
points[pointSize++] = p.points[i + 0];
points[pointSize++] = p.points[i + 1];
}
// Skip first type, beacuse it's always MOVETO
- for(int i = p.typeSize - 1; i >= 1; i--) {
+ for (int i = p.typeSize - 1; i >= 1; i--) {
types[typeSize++] = p.types[i];
}
xLast = points[pointSize - 2];
@@ -2169,29 +2408,30 @@ public class BasicStroke implements Stroke {
/**
* Creates the general path.
*
- * @return the general path
+ * @return the general path.
*/
GeneralPath createGeneralPath() {
GeneralPath p = new GeneralPath();
int j = 0;
- for(int i = 0; i < typeSize; i++) {
+ for (int i = 0; i < typeSize; i++) {
int type = types[i];
- switch(type){
- case PathIterator.SEG_MOVETO:
- p.moveTo(points[j], points[j + 1]);
- break;
- case PathIterator.SEG_LINETO:
- p.lineTo(points[j], points[j + 1]);
- break;
- case PathIterator.SEG_QUADTO:
- p.quadTo(points[j], points[j + 1], points[j + 2], points[j + 3]);
- break;
- case PathIterator.SEG_CUBICTO:
- p.curveTo(points[j], points[j + 1], points[j + 2], points[j + 3], points[j + 4], points[j + 5]);
- break;
- case PathIterator.SEG_CLOSE:
- p.closePath();
- break;
+ switch (type) {
+ case PathIterator.SEG_MOVETO:
+ p.moveTo(points[j], points[j + 1]);
+ break;
+ case PathIterator.SEG_LINETO:
+ p.lineTo(points[j], points[j + 1]);
+ break;
+ case PathIterator.SEG_QUADTO:
+ p.quadTo(points[j], points[j + 1], points[j + 2], points[j + 3]);
+ break;
+ case PathIterator.SEG_CUBICTO:
+ p.curveTo(points[j], points[j + 1], points[j + 2], points[j + 3],
+ points[j + 4], points[j + 5]);
+ break;
+ case PathIterator.SEG_CLOSE:
+ p.closePath();
+ break;
}
j += pointShift[type];
}
@@ -2201,4 +2441,3 @@ public class BasicStroke implements Stroke {
}
}
-
diff --git a/awt/java/awt/BufferCapabilities.java b/awt/java/awt/BufferCapabilities.java
index 80e8add53f5f4b6499088436e6ba1e284d805b9a..cd5fe7b1c73337c8b0ef83261ea0a1317a832e1d 100644
--- a/awt/java/awt/BufferCapabilities.java
+++ b/awt/java/awt/BufferCapabilities.java
@@ -18,35 +18,45 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
-package java.awt;
+package java.awt;
/**
- * The BufferCapabilities class represents the capabilities
- * and other properties of the image buffers.
+ * The BufferCapabilities class represents the capabilities and other properties
+ * of the image buffers.
+ *
+ * @since Android 1.0
*/
public class BufferCapabilities implements Cloneable {
-
- /** The front buffer capabilities. */
+
+ /**
+ * The front buffer capabilities.
+ */
private final ImageCapabilities frontBufferCapabilities;
-
- /** The back buffer capabilities. */
+
+ /**
+ * The back buffer capabilities.
+ */
private final ImageCapabilities backBufferCapabilities;
-
- /** The flip contents. */
+
+ /**
+ * The flip contents.
+ */
private final FlipContents flipContents;
/**
* Instantiates a new BufferCapabilities object.
*
- * @param frontBufferCapabilities the front buffer capabilities,
- * can not be null.
- * @param backBufferCapabilities the the back and intermediate
- * buffers capabilities, can not be null.
- * @param flipContents the back buffer contents after page flipping,
- * null if page flipping is not used.
+ * @param frontBufferCapabilities
+ * the front buffer capabilities, can not be null.
+ * @param backBufferCapabilities
+ * the the back and intermediate buffers capabilities, can not be
+ * null.
+ * @param flipContents
+ * the back buffer contents after page flipping, null if page
+ * flipping is not used.
*/
- public BufferCapabilities(ImageCapabilities frontBufferCapabilities,
+ public BufferCapabilities(ImageCapabilities frontBufferCapabilities,
ImageCapabilities backBufferCapabilities, FlipContents flipContents) {
if (frontBufferCapabilities == null || backBufferCapabilities == null) {
throw new IllegalArgumentException();
@@ -70,8 +80,8 @@ public class BufferCapabilities implements Cloneable {
/**
* Gets the image capabilities of the front buffer.
*
- * @return the ImageCapabilities object represented capabilities
- * of the front buffer.
+ * @return the ImageCapabilities object represented capabilities of the
+ * front buffer.
*/
public ImageCapabilities getFrontBufferCapabilities() {
return frontBufferCapabilities;
@@ -80,15 +90,15 @@ public class BufferCapabilities implements Cloneable {
/**
* Gets the image capabilities of the back buffer.
*
- * @return the ImageCapabilities object represented capabilities
- * of the back buffer.
+ * @return the ImageCapabilities object represented capabilities of the back
+ * buffer.
*/
public ImageCapabilities getBackBufferCapabilities() {
return backBufferCapabilities;
}
/**
- * Gets the flip contents of the back buffer after page-flipping.
+ * Gets the flip contents of the back buffer after page-flipping.
*
* @return the FlipContents of the back buffer after page-flipping.
*/
@@ -99,8 +109,7 @@ public class BufferCapabilities implements Cloneable {
/**
* Checks if the buffer strategy uses page flipping.
*
- * @return true, if the buffer strategy uses page flipping,
- * false otherwise.
+ * @return true, if the buffer strategy uses page flipping, false otherwise.
*/
public boolean isPageFlipping() {
return flipContents != null;
@@ -110,7 +119,7 @@ public class BufferCapabilities implements Cloneable {
* Checks if page flipping is only available in full-screen mode.
*
* @return true, if page flipping is only available in full-screen mode,
- * false otherwise.
+ * false otherwise.
*/
public boolean isFullScreenRequired() {
return false;
@@ -119,39 +128,40 @@ public class BufferCapabilities implements Cloneable {
/**
* Checks if page flipping can be performed using more than two buffers.
*
- * @return true, if page flipping can be performed using more than two buffers,
- * false otherwise.
+ * @return true, if page flipping can be performed using more than two
+ * buffers, false otherwise.
*/
public boolean isMultiBufferAvailable() {
return false;
}
/**
- * The FlipContents class represents a set of possible back buffer contents
+ * The FlipContents class represents a set of possible back buffer contents
* after page-flipping.
+ *
+ * @since Android 1.0
*/
public static final class FlipContents {
-
+
/**
- * The back buffered contents are cleared with the background color
+ * The back buffered contents are cleared with the background color
* after flipping.
*/
public static final FlipContents BACKGROUND = new FlipContents();
-
- /**
- * The back buffered contents are copied to the front buffer before
+
+ /**
+ * The back buffered contents are copied to the front buffer before
* flipping.
*/
public static final FlipContents COPIED = new FlipContents();
-
- /**
- * The back buffer contents are the prior contents of the
- * front buffer.
+
+ /**
+ * The back buffer contents are the prior contents of the front buffer.
*/
public static final FlipContents PRIOR = new FlipContents();
-
- /**
- * The back buffer contents are undefined after flipping
+
+ /**
+ * The back buffer contents are undefined after flipping
*/
public static final FlipContents UNDEFINED = new FlipContents();
diff --git a/awt/java/awt/Color.java b/awt/java/awt/Color.java
index e1e4178e9992f885ba8d253aa4d17cec71651e77..93c532d784a35af87d5a41dc8dfe6bdd48c5ce90 100644
--- a/awt/java/awt/Color.java
+++ b/awt/java/awt/Color.java
@@ -18,6 +18,7 @@
* @author Oleg V. Khaschansky
* @version $Revision$
*/
+
package java.awt;
import java.awt.color.ColorSpace;
@@ -33,155 +34,230 @@ import java.util.Arrays;
import org.apache.harmony.awt.internal.nls.Messages;
/**
- * The Color class defines colors in the default sRGB color
- * space or in the specified ColorSpace. Every Color contains alpha value.
- * The alpha value defines the transparency of a color and can be represented
- * by a float value in the range 0.0 - 1.0 or 0 - 255.
- */
+ * The Color class defines colors in the default sRGB color space or in the
+ * specified ColorSpace. Every Color contains alpha value. The alpha value
+ * defines the transparency of a color and can be represented by a float value
+ * in the range 0.0 - 1.0 or 0 - 255.
+ *
+ * @since Android 1.0
+ */
public class Color implements Paint, Serializable {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = 118526816881161077L;
/*
- * The values of the following colors are based on 1.5 release behavior which
- * can be revealed using the following or similar code:
- * Color c = Color.white;
- * System.out.println(c);
+ * The values of the following colors are based on 1.5 release behavior
+ * which can be revealed using the following or similar code: Color c =
+ * Color.white; System.out.println(c);
*/
- /** The color white. */
+ /**
+ * The color white.
+ */
public static final Color white = new Color(255, 255, 255);
- /** The color white. */
+ /**
+ * The color white.
+ */
public static final Color WHITE = white;
- /** The color light gray. */
+ /**
+ * The color light gray.
+ */
public static final Color lightGray = new Color(192, 192, 192);
- /** The color light gray. */
+ /**
+ * The color light gray.
+ */
public static final Color LIGHT_GRAY = lightGray;
- /** The color gray. */
+ /**
+ * The color gray.
+ */
public static final Color gray = new Color(128, 128, 128);
- /** The color gray. */
+ /**
+ * The color gray.
+ */
public static final Color GRAY = gray;
- /** The color dark gray. */
+ /**
+ * The color dark gray.
+ */
public static final Color darkGray = new Color(64, 64, 64);
- /** The color dark gray. */
+ /**
+ * The color dark gray.
+ */
public static final Color DARK_GRAY = darkGray;
- /** The color black. */
+ /**
+ * The color black.
+ */
public static final Color black = new Color(0, 0, 0);
- /** The color black. */
+ /**
+ * The color black.
+ */
public static final Color BLACK = black;
- /** The color red. */
+ /**
+ * The color red.
+ */
public static final Color red = new Color(255, 0, 0);
- /** The color red. */
+ /**
+ * The color red.
+ */
public static final Color RED = red;
- /** The color pink. */
+ /**
+ * The color pink.
+ */
public static final Color pink = new Color(255, 175, 175);
- /** The color pink. */
+ /**
+ * The color pink.
+ */
public static final Color PINK = pink;
- /** The color orange. */
+ /**
+ * The color orange.
+ */
public static final Color orange = new Color(255, 200, 0);
- /** The color orange. */
+ /**
+ * The color orange.
+ */
public static final Color ORANGE = orange;
- /** The color yellow. */
+ /**
+ * The color yellow.
+ */
public static final Color yellow = new Color(255, 255, 0);
- /** The color yellow. */
+ /**
+ * The color yellow.
+ */
public static final Color YELLOW = yellow;
- /** The color green. */
+ /**
+ * The color green.
+ */
public static final Color green = new Color(0, 255, 0);
- /** The color green. */
+ /**
+ * The color green.
+ */
public static final Color GREEN = green;
- /** The color magenta. */
+ /**
+ * The color magenta.
+ */
public static final Color magenta = new Color(255, 0, 255);
- /** The color magenta. */
+ /**
+ * The color magenta.
+ */
public static final Color MAGENTA = magenta;
- /** The color cyan. */
+ /**
+ * The color cyan.
+ */
public static final Color cyan = new Color(0, 255, 255);
- /** The color cyan. */
+ /**
+ * The color cyan.
+ */
public static final Color CYAN = cyan;
- /** The color blue. */
+ /**
+ * The color blue.
+ */
public static final Color blue = new Color(0, 0, 255);
- /** The color blue. */
+ /**
+ * The color blue.
+ */
public static final Color BLUE = blue;
- /** integer RGB value. */
+ /**
+ * integer RGB value.
+ */
int value;
- /** Float sRGB value. */
+ /**
+ * Float sRGB value.
+ */
private float[] frgbvalue;
- /** Color in an arbitrary color space with float components. If null, other value should be used. */
+ /**
+ * Color in an arbitrary color space with float components. If
+ * null, other value should be used.
+ */
private float fvalue[];
- /** Float alpha value. If frgbvalue is null, this is not valid data. */
+ /**
+ * Float alpha value. If frgbvalue is null, this is not valid data.
+ */
private float falpha;
- /** The color's color space if applicable. */
+ /**
+ * The color's color space if applicable.
+ */
private ColorSpace cs;
/*
- * The value of the SCALE_FACTOR is based on 1.5 release behavior which
- * can be revealed using the following code:
- * Color c = new Color(100, 100, 100);
- * Color bc = c.brighter();
- * System.out.println("Brighter factor: " + ((float)c.getRed())/((float)bc.getRed()));
- * Color dc = c.darker();
- * System.out.println("Darker factor: " + ((float)dc.getRed())/((float)c.getRed()));
- * The result is the same for brighter and darker methods, so we need only
- * one scale factor for both.
- */
- /** The Constant SCALE_FACTOR. */
+ * The value of the SCALE_FACTOR is based on 1.5 release behavior which can
+ * be revealed using the following code: Color c = new Color(100, 100, 100);
+ * Color bc = c.brighter(); System.out.println("Brighter factor: " +
+ * ((float)c.getRed())/((float)bc.getRed())); Color dc = c.darker();
+ * System.out.println("Darker factor: " +
+ * ((float)dc.getRed())/((float)c.getRed())); The result is the same for
+ * brighter and darker methods, so we need only one scale factor for both.
+ */
+ /**
+ * The Constant SCALE_FACTOR.
+ */
private static final double SCALE_FACTOR = 0.7;
- /** The Constant MIN_SCALABLE. */
- private static final int MIN_SCALABLE = 3; // should increase when multiplied by SCALE_FACTOR
+ /**
+ * The Constant MIN_SCALABLE.
+ */
+ private static final int MIN_SCALABLE = 3; // should increase when
+
+ // multiplied by SCALE_FACTOR
- /** The current paint context. */
+ /**
+ * The current paint context.
+ */
transient private PaintContext currentPaintContext;
/**
- * Creates a color in the specified ColorSpace, the specified color
- * components and the specified alpha.
+ * Creates a color in the specified ColorSpace, the specified color
+ * components and the specified alpha.
*
- * @param cspace the ColorSpace to be used to define the components.
- * @param components the components.
- * @param alpha the alpha.
+ * @param cspace
+ * the ColorSpace to be used to define the components.
+ * @param components
+ * the components.
+ * @param alpha
+ * the alpha.
*/
public Color(ColorSpace cspace, float[] components, float alpha) {
int nComps = cspace.getNumComponents();
float comp;
fvalue = new float[nComps];
- for(int i=0 ; i 1.0f) {
- // awt.107=Color parameter outside of expected range: component {0}.
- throw new IllegalArgumentException(
- Messages.getString("awt.107", i)); //$NON-NLS-1$
+ if (comp < 0.0f || comp > 1.0f) {
+ // awt.107=Color parameter outside of expected range: component
+ // {0}.
+ throw new IllegalArgumentException(Messages.getString("awt.107", i)); //$NON-NLS-1$
}
fvalue[i] = components[i];
}
@@ -196,22 +272,22 @@ public class Color implements Paint, Serializable {
frgbvalue = cs.toRGB(fvalue);
- value = ((int)(frgbvalue[2]*255 + 0.5)) |
- (((int)(frgbvalue[1]*255 + 0.5)) << 8 ) |
- (((int)(frgbvalue[0]*255 + 0.5)) << 16 ) |
- (((int)(falpha*255 + 0.5)) << 24 );
+ value = ((int)(frgbvalue[2] * 255 + 0.5)) | (((int)(frgbvalue[1] * 255 + 0.5)) << 8)
+ | (((int)(frgbvalue[0] * 255 + 0.5)) << 16) | (((int)(falpha * 255 + 0.5)) << 24);
}
/**
- * Instantiates a new sRGB color with the specified combined
- * RGBA value consisting of the alpha component in bits 24-31,
- * the red component in bits 16-23, the green component in bits 8-15,
- * and the blue component in bits 0-7. If the hasalpha argument is
- * false, the alpha has default value - 255.
+ * Instantiates a new sRGB color with the specified combined RGBA value
+ * consisting of the alpha component in bits 24-31, the red component in
+ * bits 16-23, the green component in bits 8-15, and the blue component in
+ * bits 0-7. If the hasalpha argument is false, the alpha has default value
+ * - 255.
*
- * @param rgba the RGBA components.
- * @param hasAlpha alpha parameter is true if alpha bits are valid,
- * false otherwise.
+ * @param rgba
+ * the RGBA components.
+ * @param hasAlpha
+ * the alpha parameter is true if alpha bits are valid, false
+ * otherwise.
*/
public Color(int rgba, boolean hasAlpha) {
if (!hasAlpha) {
@@ -222,13 +298,17 @@ public class Color implements Paint, Serializable {
}
/**
- * Instantiates a new color with the specified red, green, blue and alpha
+ * Instantiates a new color with the specified red, green, blue and alpha
* components.
*
- * @param r the red component.
- * @param g the green component.
- * @param b the blue component.
- * @param a the alpha component.
+ * @param r
+ * the red component.
+ * @param g
+ * the green component.
+ * @param b
+ * the blue component.
+ * @param a
+ * the alpha component.
*/
public Color(int r, int g, int b, int a) {
if ((r & 0xFF) != r || (g & 0xFF) != g || (b & 0xFF) != b || (a & 0xFF) != a) {
@@ -239,12 +319,15 @@ public class Color implements Paint, Serializable {
}
/**
- * Instantiates a new opaque sRGB color with the specified red, green,
- * and blue values. The Alpha component is set to the default - 1.0.
+ * Instantiates a new opaque sRGB color with the specified red, green, and
+ * blue values. The Alpha component is set to the default - 1.0.
*
- * @param r the red component.
- * @param g the green component.
- * @param b the blue component.
+ * @param r
+ * the red component.
+ * @param g
+ * the green component.
+ * @param b
+ * the blue component.
*/
public Color(int r, int g, int b) {
if ((r & 0xFF) != r || (g & 0xFF) != g || (b & 0xFF) != b) {
@@ -256,31 +339,32 @@ public class Color implements Paint, Serializable {
}
/**
- * Instantiates a new sRGB color with the specified
- * RGB value consisting of the red component in bits 16-23,
- * the green component in bits 8-15, and the blue component
- * in bits 0-7. Alpha has default value - 255.
+ * Instantiates a new sRGB color with the specified RGB value consisting of
+ * the red component in bits 16-23, the green component in bits 8-15, and
+ * the blue component in bits 0-7. Alpha has default value - 255.
*
- * @param rgb the RGB components.
+ * @param rgb
+ * the RGB components.
*/
public Color(int rgb) {
value = rgb | 0xFF000000;
}
/**
- * Instantiates a new color with the specified red, green, blue and alpha
+ * Instantiates a new color with the specified red, green, blue and alpha
* components.
*
- * @param r the red component.
- * @param g the green component.
- * @param b the blue component.
- * @param a the alpha component.
+ * @param r
+ * the red component.
+ * @param g
+ * the green component.
+ * @param b
+ * the blue component.
+ * @param a
+ * the alpha component.
*/
public Color(float r, float g, float b, float a) {
- this((int)(r*255+0.5),
- (int)(g*255+0.5),
- (int)(b*255+0.5),
- (int)(a*255+0.5));
+ this((int)(r * 255 + 0.5), (int)(g * 255 + 0.5), (int)(b * 255 + 0.5), (int)(a * 255 + 0.5));
falpha = a;
fvalue = new float[3];
fvalue[0] = r;
@@ -290,25 +374,23 @@ public class Color implements Paint, Serializable {
}
/**
- * Instantiates a new color with the specified red, green, and blue
- * components and default alfa value - 1.0.
+ * Instantiates a new color with the specified red, green, and blue
+ * components and default alpha value - 1.0.
*
- * @param r the red component.
- * @param g the green component.
- * @param b the blue component.
+ * @param r
+ * the red component.
+ * @param g
+ * the green component.
+ * @param b
+ * the blue component.
*/
public Color(float r, float g, float b) {
this(r, g, b, 1.0f);
}
- public PaintContext createContext(
- ColorModel cm,
- Rectangle r,
- Rectangle2D r2d,
- AffineTransform xform,
- RenderingHints rhs
- ) {
- if(currentPaintContext != null) {
+ public PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d,
+ AffineTransform xform, RenderingHints rhs) {
+ if (currentPaintContext != null) {
return currentPaintContext;
}
currentPaintContext = new Color.ColorPaintContext(value);
@@ -323,15 +405,12 @@ public class Color implements Paint, Serializable {
@Override
public String toString() {
/*
- The format of the string is based on 1.5 release behavior which
- can be revealed using the following code:
-
- Color c = new Color(1, 2, 3);
- System.out.println(c);
- */
-
- return getClass().getName() +
- "[r=" + getRed() + //$NON-NLS-1$
+ * The format of the string is based on 1.5 release behavior which can
+ * be revealed using the following code: Color c = new Color(1, 2, 3);
+ * System.out.println(c);
+ */
+
+ return getClass().getName() + "[r=" + getRed() + //$NON-NLS-1$
",g=" + getGreen() + //$NON-NLS-1$
",b=" + getBlue() + //$NON-NLS-1$
"]"; //$NON-NLS-1$
@@ -340,65 +419,67 @@ public class Color implements Paint, Serializable {
/**
* Compares the specified Object to the Color.
*
- * @param obj the Object to be compared.
- *
- * @return true, if the specified Object is a Color whose
- * value is equal to this Color, false otherwise.
+ * @param obj
+ * the Object to be compared.
+ * @return true, if the specified Object is a Color whose value is equal to
+ * this Color, false otherwise.
*/
@Override
public boolean equals(Object obj) {
- if(obj instanceof Color) {
+ if (obj instanceof Color) {
return ((Color)obj).value == this.value;
}
return false;
}
/**
- * Returns a float array containing the color and alpha components of
- * the Color in the specified ColorSpace.
- *
- * @param colorSpace the specified ColorSpace.
- * @param components the results of this method will be written to
- * this float array. If null, a float array will be created.
+ * Returns a float array containing the color and alpha components of the
+ * Color in the specified ColorSpace.
*
+ * @param colorSpace
+ * the specified ColorSpace.
+ * @param components
+ * the results of this method will be written to this float
+ * array. If null, a float array will be created.
* @return the color and alpha components in a float array.
*/
public float[] getComponents(ColorSpace colorSpace, float[] components) {
int nComps = colorSpace.getNumComponents();
- if(components == null) {
- components = new float[nComps+1];
+ if (components == null) {
+ components = new float[nComps + 1];
}
getColorComponents(colorSpace, components);
- if(frgbvalue != null) {
+ if (frgbvalue != null) {
components[nComps] = falpha;
} else {
- components[nComps] = getAlpha()/255f;
+ components[nComps] = getAlpha() / 255f;
}
return components;
}
/**
- * Returns a float array containing the color components of
- * the Color in the specified ColorSpace.
- *
- * @param colorSpace the specified ColorSpace.
- * @param components the results of this method will be written to
- * this float array. If null, a float array will be created.
+ * Returns a float array containing the color components of the Color in the
+ * specified ColorSpace.
*
+ * @param colorSpace
+ * the specified ColorSpace.
+ * @param components
+ * the results of this method will be written to this float
+ * array. If null, a float array will be created.
* @return the color components in a float array.
*/
public float[] getColorComponents(ColorSpace colorSpace, float[] components) {
float[] cieXYZComponents = getColorSpace().toCIEXYZ(getColorComponents(null));
float[] csComponents = colorSpace.fromCIEXYZ(cieXYZComponents);
- if(components == null) {
+ if (components == null) {
return csComponents;
}
- for(int i=0; i 255) ? 255 : r;
}
- if(b < MIN_SCALABLE && b != 0) {
+ if (b < MIN_SCALABLE && b != 0) {
b = MIN_SCALABLE;
} else {
- b = (int) (b/SCALE_FACTOR);
+ b = (int)(b / SCALE_FACTOR);
b = (b > 255) ? 255 : b;
}
- if(g < MIN_SCALABLE && g != 0) {
+ if (g < MIN_SCALABLE && g != 0) {
g = MIN_SCALABLE;
} else {
- g = (int) (g/SCALE_FACTOR);
+ g = (int)(g / SCALE_FACTOR);
g = (g > 255) ? 255 : g;
}
@@ -471,24 +550,24 @@ public class Color implements Paint, Serializable {
}
/**
- * Returns a float array containing the color and alpha components of
- * the Color in the default sRGB color space.
- *
- * @param components the results of this method will be written to
- * this float array. A new float array will be created if this
- * argument is null.
+ * Returns a float array containing the color and alpha components of the
+ * Color in the default sRGB color space.
*
+ * @param components
+ * the results of this method will be written to this float
+ * array. A new float array will be created if this argument is
+ * null.
* @return the RGB color and alpha components in a float array.
*/
public float[] getRGBComponents(float[] components) {
- if(components == null) {
+ if (components == null) {
components = new float[4];
}
- if(frgbvalue != null) {
+ if (frgbvalue != null) {
components[3] = falpha;
} else {
- components[3] = getAlpha()/255f;
+ components[3] = getAlpha() / 255f;
}
getRGBColorComponents(components);
@@ -497,52 +576,52 @@ public class Color implements Paint, Serializable {
}
/**
- * Returns a float array containing the color components of
- * the Color in the default sRGB color space.
- *
- * @param components the results of this method will be written to
- * this float array. A new float array will be created if this
- * argument is null.
+ * Returns a float array containing the color components of the Color in the
+ * default sRGB color space.
*
+ * @param components
+ * the results of this method will be written to this float
+ * array. A new float array will be created if this argument is
+ * null.
* @return the RGB color components in a float array.
*/
public float[] getRGBColorComponents(float[] components) {
- if(components == null) {
+ if (components == null) {
components = new float[3];
}
- if(frgbvalue != null) {
+ if (frgbvalue != null) {
components[2] = frgbvalue[2];
components[1] = frgbvalue[1];
components[0] = frgbvalue[0];
} else {
- components[2] = getBlue()/255f;
- components[1] = getGreen()/255f;
- components[0] = getRed()/255f;
+ components[2] = getBlue() / 255f;
+ components[1] = getGreen() / 255f;
+ components[0] = getRed() / 255f;
}
return components;
}
/**
- * Returns a float array which contains the color and alpha components of
+ * Returns a float array which contains the color and alpha components of
* the Color in the ColorSpace of the Color.
*
- * @param components the results of this method will be written to
- * this float array. A new float array will be created if this
- * argument is null.
- *
+ * @param components
+ * the results of this method will be written to this float
+ * array. A new float array will be created if this argument is
+ * null.
* @return the color and alpha components in a float array.
*/
public float[] getComponents(float[] components) {
- if(fvalue == null) {
+ if (fvalue == null) {
return getRGBComponents(components);
}
int nColorComps = fvalue.length;
- if(components == null) {
- components = new float[nColorComps+1];
+ if (components == null) {
+ components = new float[nColorComps + 1];
}
getColorComponents(components);
@@ -553,25 +632,25 @@ public class Color implements Paint, Serializable {
}
/**
- * Returns a float array which contains the color components of
- * the Color in the ColorSpace of the Color.
- *
- * @param components the results of this method will be written to
- * this float array. A new float array will be created if this
- * argument is null.
+ * Returns a float array which contains the color components of the Color in
+ * the ColorSpace of the Color.
*
+ * @param components
+ * the results of this method will be written to this float
+ * array. A new float array will be created if this argument is
+ * null.
* @return the color components in a float array.
*/
public float[] getColorComponents(float[] components) {
- if(fvalue == null) {
+ if (fvalue == null) {
return getRGBColorComponents(components);
}
- if(components == null) {
+ if (components == null) {
components = new float[fvalue.length];
}
- for(int i=0; i, Boolean> childClassesFlags = new Hashtable, Boolean>();
- /** The Constant peer. */
+ /**
+ * The Constant peer.
+ */
private static final ComponentPeer peer = new ComponentPeer() {
};
- /** The Constant incrementalImageUpdate. */
+ /**
+ * The Constant incrementalImageUpdate.
+ */
private static final boolean incrementalImageUpdate;
- /** The toolkit. */
+ /**
+ * The toolkit.
+ */
final transient Toolkit toolkit = Toolkit.getDefaultToolkit();
- //???AWT
+ // ???AWT
/*
- protected abstract class AccessibleAWTComponent extends AccessibleContext implements
- Serializable, AccessibleComponent {
- private static final long serialVersionUID = 642321655757800191L;
-
- protected class AccessibleAWTComponentHandler implements ComponentListener {
- protected AccessibleAWTComponentHandler() {
- }
-
- public void componentHidden(ComponentEvent e) {
- if (behaviour.isLightweight()) {
- return;
- }
- firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
- AccessibleState.VISIBLE, null);
- }
-
- public void componentMoved(ComponentEvent e) {
- }
-
- public void componentResized(ComponentEvent e) {
- }
-
- public void componentShown(ComponentEvent e) {
- if (behaviour.isLightweight()) {
- return;
- }
- firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null,
- AccessibleState.VISIBLE);
- }
- }
-
- protected class AccessibleAWTFocusHandler implements FocusListener {
- public void focusGained(FocusEvent e) {
- if (behaviour.isLightweight()) {
- return;
- }
- firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null,
- AccessibleState.FOCUSED);
- }
-
- public void focusLost(FocusEvent e) {
- if (behaviour.isLightweight()) {
- return;
- }
- firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
- AccessibleState.FOCUSED, null);
- }
- }
-
- protected ComponentListener accessibleAWTComponentHandler;
-
- protected FocusListener accessibleAWTFocusHandler;
- */
- /*
- * Number of registered property change listeners.
- */
- /*
- int listenersCount;
-
- public void addFocusListener(FocusListener l) {
- Component.this.addFocusListener(l);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- toolkit.lockAWT();
- try {
- super.addPropertyChangeListener(listener);
- listenersCount++;
- if (accessibleAWTComponentHandler == null) {
- accessibleAWTComponentHandler = new AccessibleAWTComponentHandler();
- Component.this.addComponentListener(accessibleAWTComponentHandler);
- }
- if (accessibleAWTFocusHandler == null) {
- accessibleAWTFocusHandler = new AccessibleAWTFocusHandler();
- Component.this.addFocusListener(accessibleAWTFocusHandler);
- }
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public boolean contains(Point p) {
- toolkit.lockAWT();
- try {
- return Component.this.contains(p);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Accessible getAccessibleAt(Point arg0) {
- toolkit.lockAWT();
- try {
- return null;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Color getBackground() {
- toolkit.lockAWT();
- try {
- return Component.this.getBackground();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Rectangle getBounds() {
- toolkit.lockAWT();
- try {
- return Component.this.getBounds();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Cursor getCursor() {
- toolkit.lockAWT();
- try {
- return Component.this.getCursor();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Font getFont() {
- toolkit.lockAWT();
- try {
- return Component.this.getFont();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public FontMetrics getFontMetrics(Font f) {
- toolkit.lockAWT();
- try {
- return Component.this.getFontMetrics(f);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Color getForeground() {
- toolkit.lockAWT();
- try {
- return Component.this.getForeground();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Point getLocation() {
- toolkit.lockAWT();
- try {
- return Component.this.getLocation();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Point getLocationOnScreen() {
- toolkit.lockAWT();
- try {
- return Component.this.getLocationOnScreen();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Dimension getSize() {
- toolkit.lockAWT();
- try {
- return Component.this.getSize();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public boolean isEnabled() {
- toolkit.lockAWT();
- try {
- return Component.this.isEnabled();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public boolean isFocusTraversable() {
- toolkit.lockAWT();
- try {
- return Component.this.isFocusTraversable();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public boolean isShowing() {
- toolkit.lockAWT();
- try {
- return Component.this.isShowing();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public boolean isVisible() {
- toolkit.lockAWT();
- try {
- return Component.this.isVisible();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void removeFocusListener(FocusListener l) {
- Component.this.removeFocusListener(l);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- toolkit.lockAWT();
- try {
- super.removePropertyChangeListener(listener);
- listenersCount--;
- if (listenersCount > 0) {
- return;
- }
- // if there are no more listeners, remove handlers:
- Component.this.removeFocusListener(accessibleAWTFocusHandler);
- Component.this.removeComponentListener(accessibleAWTComponentHandler);
- accessibleAWTComponentHandler = null;
- accessibleAWTFocusHandler = null;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void requestFocus() {
- toolkit.lockAWT();
- try {
- Component.this.requestFocus();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setBackground(Color color) {
- toolkit.lockAWT();
- try {
- Component.this.setBackground(color);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setBounds(Rectangle r) {
- toolkit.lockAWT();
- try {
- Component.this.setBounds(r);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setCursor(Cursor cursor) {
- toolkit.lockAWT();
- try {
- Component.this.setCursor(cursor);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setEnabled(boolean enabled) {
- toolkit.lockAWT();
- try {
- Component.this.setEnabled(enabled);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setFont(Font f) {
- toolkit.lockAWT();
- try {
- Component.this.setFont(f);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setForeground(Color color) {
- toolkit.lockAWT();
- try {
- Component.this.setForeground(color);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setLocation(Point p) {
- toolkit.lockAWT();
- try {
- Component.this.setLocation(p);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setSize(Dimension size) {
- toolkit.lockAWT();
- try {
- Component.this.setSize(size);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void setVisible(boolean visible) {
- toolkit.lockAWT();
- try {
- Component.this.setVisible(visible);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public Accessible getAccessibleParent() {
- toolkit.lockAWT();
- try {
- Accessible aParent = super.getAccessibleParent();
- if (aParent != null) {
- return aParent;
- }
- Container parent = getParent();
- return (parent instanceof Accessible ? (Accessible) parent : null);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public Accessible getAccessibleChild(int i) {
- toolkit.lockAWT();
- try {
- return null;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public int getAccessibleChildrenCount() {
- toolkit.lockAWT();
- try {
- return 0;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public AccessibleComponent getAccessibleComponent() {
- return this;
- }
-
- @Override
- public String getAccessibleDescription() {
- return super.getAccessibleDescription(); // why override?
- }
-
- @Override
- public int getAccessibleIndexInParent() {
- toolkit.lockAWT();
- try {
- if (getAccessibleParent() == null) {
- return -1;
- }
- int count = 0;
- Container parent = getParent();
- for (int i = 0; i < parent.getComponentCount(); i++) {
- Component aComp = parent.getComponent(i);
- if (aComp instanceof Accessible) {
- if (aComp == Component.this) {
- return count;
- }
- ++count;
- }
- }
- return -1;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public AccessibleRole getAccessibleRole() {
- toolkit.lockAWT();
- try {
- return AccessibleRole.AWT_COMPONENT;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public AccessibleStateSet getAccessibleStateSet() {
- toolkit.lockAWT();
- try {
- AccessibleStateSet set = new AccessibleStateSet();
- if (isEnabled()) {
- set.add(AccessibleState.ENABLED);
- }
- if (isFocusable()) {
- set.add(AccessibleState.FOCUSABLE);
- }
- if (hasFocus()) {
- set.add(AccessibleState.FOCUSED);
- }
- if (isOpaque()) {
- set.add(AccessibleState.OPAQUE);
- }
- if (isShowing()) {
- set.add(AccessibleState.SHOWING);
- }
- if (isVisible()) {
- set.add(AccessibleState.VISIBLE);
- }
- return set;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public Locale getLocale() throws IllegalComponentStateException {
- toolkit.lockAWT();
- try {
- return Component.this.getLocale();
- } finally {
- toolkit.unlockAWT();
- }
- }
- }
- */
- /**
- * The BltBufferStrategy class provides opportunity of blitting
- * offscreen surfaces to a component. For more information on
- * blitting, see Bit blit.
+ * protected abstract class AccessibleAWTComponent extends AccessibleContext
+ * implements Serializable, AccessibleComponent { private static final long
+ * serialVersionUID = 642321655757800191L; protected class
+ * AccessibleAWTComponentHandler implements ComponentListener { protected
+ * AccessibleAWTComponentHandler() { } public void
+ * componentHidden(ComponentEvent e) { if (behaviour.isLightweight()) {
+ * return; } firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ * AccessibleState.VISIBLE, null); } public void
+ * componentMoved(ComponentEvent e) { } public void
+ * componentResized(ComponentEvent e) { } public void
+ * componentShown(ComponentEvent e) { if (behaviour.isLightweight()) {
+ * return; } firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ * null, AccessibleState.VISIBLE); } } protected class
+ * AccessibleAWTFocusHandler implements FocusListener { public void
+ * focusGained(FocusEvent e) { if (behaviour.isLightweight()) { return; }
+ * firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null,
+ * AccessibleState.FOCUSED); } public void focusLost(FocusEvent e) { if
+ * (behaviour.isLightweight()) { return; }
+ * firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ * AccessibleState.FOCUSED, null); } } protected ComponentListener
+ * accessibleAWTComponentHandler; protected FocusListener
+ * accessibleAWTFocusHandler;
+ */
+ /*
+ * Number of registered property change listeners.
+ */
+ /*
+ * int listenersCount; public void addFocusListener(FocusListener l) {
+ * Component.this.addFocusListener(l); }
+ * @Override public void addPropertyChangeListener(PropertyChangeListener
+ * listener) { toolkit.lockAWT(); try {
+ * super.addPropertyChangeListener(listener); listenersCount++; if
+ * (accessibleAWTComponentHandler == null) { accessibleAWTComponentHandler =
+ * new AccessibleAWTComponentHandler();
+ * Component.this.addComponentListener(accessibleAWTComponentHandler); } if
+ * (accessibleAWTFocusHandler == null) { accessibleAWTFocusHandler = new
+ * AccessibleAWTFocusHandler();
+ * Component.this.addFocusListener(accessibleAWTFocusHandler); } } finally {
+ * toolkit.unlockAWT(); } } public boolean contains(Point p) {
+ * toolkit.lockAWT(); try { return Component.this.contains(p); } finally {
+ * toolkit.unlockAWT(); } } public Accessible getAccessibleAt(Point arg0) {
+ * toolkit.lockAWT(); try { return null; } finally { toolkit.unlockAWT(); }
+ * } public Color getBackground() { toolkit.lockAWT(); try { return
+ * Component.this.getBackground(); } finally { toolkit.unlockAWT(); } }
+ * public Rectangle getBounds() { toolkit.lockAWT(); try { return
+ * Component.this.getBounds(); } finally { toolkit.unlockAWT(); } } public
+ * Cursor getCursor() { toolkit.lockAWT(); try { return
+ * Component.this.getCursor(); } finally { toolkit.unlockAWT(); } } public
+ * Font getFont() { toolkit.lockAWT(); try { return
+ * Component.this.getFont(); } finally { toolkit.unlockAWT(); } } public
+ * FontMetrics getFontMetrics(Font f) { toolkit.lockAWT(); try { return
+ * Component.this.getFontMetrics(f); } finally { toolkit.unlockAWT(); } }
+ * public Color getForeground() { toolkit.lockAWT(); try { return
+ * Component.this.getForeground(); } finally { toolkit.unlockAWT(); } }
+ * public Point getLocation() { toolkit.lockAWT(); try { return
+ * Component.this.getLocation(); } finally { toolkit.unlockAWT(); } } public
+ * Point getLocationOnScreen() { toolkit.lockAWT(); try { return
+ * Component.this.getLocationOnScreen(); } finally { toolkit.unlockAWT(); }
+ * } public Dimension getSize() { toolkit.lockAWT(); try { return
+ * Component.this.getSize(); } finally { toolkit.unlockAWT(); } } public
+ * boolean isEnabled() { toolkit.lockAWT(); try { return
+ * Component.this.isEnabled(); } finally { toolkit.unlockAWT(); } } public
+ * boolean isFocusTraversable() { toolkit.lockAWT(); try { return
+ * Component.this.isFocusTraversable(); } finally { toolkit.unlockAWT(); } }
+ * public boolean isShowing() { toolkit.lockAWT(); try { return
+ * Component.this.isShowing(); } finally { toolkit.unlockAWT(); } } public
+ * boolean isVisible() { toolkit.lockAWT(); try { return
+ * Component.this.isVisible(); } finally { toolkit.unlockAWT(); } } public
+ * void removeFocusListener(FocusListener l) {
+ * Component.this.removeFocusListener(l); }
+ * @Override public void removePropertyChangeListener(PropertyChangeListener
+ * listener) { toolkit.lockAWT(); try {
+ * super.removePropertyChangeListener(listener); listenersCount--; if
+ * (listenersCount > 0) { return; } // if there are no more listeners,
+ * remove handlers:
+ * Component.this.removeFocusListener(accessibleAWTFocusHandler);
+ * Component.this.removeComponentListener(accessibleAWTComponentHandler);
+ * accessibleAWTComponentHandler = null; accessibleAWTFocusHandler = null; }
+ * finally { toolkit.unlockAWT(); } } public void requestFocus() {
+ * toolkit.lockAWT(); try { Component.this.requestFocus(); } finally {
+ * toolkit.unlockAWT(); } } public void setBackground(Color color) {
+ * toolkit.lockAWT(); try { Component.this.setBackground(color); } finally {
+ * toolkit.unlockAWT(); } } public void setBounds(Rectangle r) {
+ * toolkit.lockAWT(); try { Component.this.setBounds(r); } finally {
+ * toolkit.unlockAWT(); } } public void setCursor(Cursor cursor) {
+ * toolkit.lockAWT(); try { Component.this.setCursor(cursor); } finally {
+ * toolkit.unlockAWT(); } } public void setEnabled(boolean enabled) {
+ * toolkit.lockAWT(); try { Component.this.setEnabled(enabled); } finally {
+ * toolkit.unlockAWT(); } } public void setFont(Font f) { toolkit.lockAWT();
+ * try { Component.this.setFont(f); } finally { toolkit.unlockAWT(); } }
+ * public void setForeground(Color color) { toolkit.lockAWT(); try {
+ * Component.this.setForeground(color); } finally { toolkit.unlockAWT(); } }
+ * public void setLocation(Point p) { toolkit.lockAWT(); try {
+ * Component.this.setLocation(p); } finally { toolkit.unlockAWT(); } }
+ * public void setSize(Dimension size) { toolkit.lockAWT(); try {
+ * Component.this.setSize(size); } finally { toolkit.unlockAWT(); } } public
+ * void setVisible(boolean visible) { toolkit.lockAWT(); try {
+ * Component.this.setVisible(visible); } finally { toolkit.unlockAWT(); } }
+ * @Override public Accessible getAccessibleParent() { toolkit.lockAWT();
+ * try { Accessible aParent = super.getAccessibleParent(); if (aParent !=
+ * null) { return aParent; } Container parent = getParent(); return (parent
+ * instanceof Accessible ? (Accessible) parent : null); } finally {
+ * toolkit.unlockAWT(); } }
+ * @Override public Accessible getAccessibleChild(int i) {
+ * toolkit.lockAWT(); try { return null; } finally { toolkit.unlockAWT(); }
+ * }
+ * @Override public int getAccessibleChildrenCount() { toolkit.lockAWT();
+ * try { return 0; } finally { toolkit.unlockAWT(); } }
+ * @Override public AccessibleComponent getAccessibleComponent() { return
+ * this; }
+ * @Override public String getAccessibleDescription() { return
+ * super.getAccessibleDescription(); // why override? }
+ * @Override public int getAccessibleIndexInParent() { toolkit.lockAWT();
+ * try { if (getAccessibleParent() == null) { return -1; } int count = 0;
+ * Container parent = getParent(); for (int i = 0; i <
+ * parent.getComponentCount(); i++) { Component aComp =
+ * parent.getComponent(i); if (aComp instanceof Accessible) { if (aComp ==
+ * Component.this) { return count; } ++count; } } return -1; } finally {
+ * toolkit.unlockAWT(); } }
+ * @Override public AccessibleRole getAccessibleRole() { toolkit.lockAWT();
+ * try { return AccessibleRole.AWT_COMPONENT; } finally {
+ * toolkit.unlockAWT(); } }
+ * @Override public AccessibleStateSet getAccessibleStateSet() {
+ * toolkit.lockAWT(); try { AccessibleStateSet set = new
+ * AccessibleStateSet(); if (isEnabled()) {
+ * set.add(AccessibleState.ENABLED); } if (isFocusable()) {
+ * set.add(AccessibleState.FOCUSABLE); } if (hasFocus()) {
+ * set.add(AccessibleState.FOCUSED); } if (isOpaque()) {
+ * set.add(AccessibleState.OPAQUE); } if (isShowing()) {
+ * set.add(AccessibleState.SHOWING); } if (isVisible()) {
+ * set.add(AccessibleState.VISIBLE); } return set; } finally {
+ * toolkit.unlockAWT(); } }
+ * @Override public Locale getLocale() throws IllegalComponentStateException
+ * { toolkit.lockAWT(); try { return Component.this.getLocale(); } finally {
+ * toolkit.unlockAWT(); } } }
+ */
+ /**
+ * The BltBufferStrategy class provides opportunity of blitting offscreen
+ * surfaces to a component. For more information on blitting, see Bit blit.
+ *
+ * @since Android 1.0
*/
protected class BltBufferStrategy extends BufferStrategy {
-
- /** The back buffers. */
+
+ /**
+ * The back buffers.
+ */
protected VolatileImage[] backBuffers;
- /** The caps. */
+ /**
+ * The caps.
+ */
protected BufferCapabilities caps;
- /** The width. */
+ /**
+ * The width.
+ */
protected int width;
- /** The height. */
+ /**
+ * The height.
+ */
protected int height;
- /** The validated contents. */
+ /**
+ * The validated contents.
+ */
protected boolean validatedContents;
/**
* Instantiates a new BltBufferStrategy buffer strategy.
*
- * @param numBuffers the number of buffers.
- * @param caps the BufferCapabilities.
- *
- * @throws NotImplementedException the not implemented exception.
+ * @param numBuffers
+ * the number of buffers.
+ * @param caps
+ * the BufferCapabilities.
+ * @throws NotImplementedException
+ * the not implemented exception.
*/
- protected BltBufferStrategy(int numBuffers, BufferCapabilities caps) throws org.apache.harmony.luni.util.NotImplementedException {
+ protected BltBufferStrategy(int numBuffers, BufferCapabilities caps)
+ throws org.apache.harmony.luni.util.NotImplementedException {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
/**
- * Returns true if the drawing buffer has been lost since the last call
- * to getDrawGraphics.
+ * Returns true if the drawing buffer has been lost since the last call
+ * to getDrawGraphics.
*
- * @return true if the drawing buffer has been lost since the last call
- * to getDrawGraphics, false otherwise.
- *
+ * @return true if the drawing buffer has been lost since the last call
+ * to getDrawGraphics, false otherwise.
* @see java.awt.image.BufferStrategy#contentsLost()
*/
@Override
@@ -634,9 +360,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* state and reinitialized to the default background color.
*
* @return true if the drawing buffer has been restored from a lost
- * state and reinitialized to the default background color,
- * false otherwise.
- *
+ * state and reinitialized to the default background color,
+ * false otherwise.
* @see java.awt.image.BufferStrategy#contentsRestored()
*/
@Override
@@ -650,7 +375,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Creates the back buffers.
*
- * @param numBuffers the number of buffers.
+ * @param numBuffers
+ * the number of buffers.
*/
protected void createBackBuffers(int numBuffers) {
if (true) {
@@ -662,19 +388,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Returns the BufferCapabilities of the buffer strategy.
*
* @return the BufferCapabilities.
- *
* @see java.awt.image.BufferStrategy#getCapabilities()
*/
@Override
public BufferCapabilities getCapabilities() {
- return (BufferCapabilities) caps.clone();
+ return (BufferCapabilities)caps.clone();
}
/**
* Gets Graphics of current buffer strategy.
*
* @return the Graphics of current buffer strategy.
- *
* @see java.awt.image.BufferStrategy#getDrawGraphics()
*/
@Override
@@ -708,56 +432,68 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * The FlipBufferStrategy class is for flipping buffers on a component.
+ * The FlipBufferStrategy class is for flipping buffers on a component.
+ *
+ * @since Android 1.0
*/
protected class FlipBufferStrategy extends BufferStrategy {
-
- /** The Buffer Capabilities. */
+
+ /**
+ * The Buffer Capabilities.
+ */
protected BufferCapabilities caps;
- /** The drawing buffer. */
+ /**
+ * The drawing buffer.
+ */
protected Image drawBuffer;
- /** The drawing VolatileImage buffer. */
+ /**
+ * The drawing VolatileImage buffer.
+ */
protected VolatileImage drawVBuffer;
- /** The number of buffers. */
+ /**
+ * The number of buffers.
+ */
protected int numBuffers;
- /** The validated contents indicates if the drawing buffer is restored from
- * lost state. */
+ /**
+ * The validated contents indicates if the drawing buffer is restored
+ * from lost state.
+ */
protected boolean validatedContents;
/**
* Instantiates a new flip buffer strategy.
*
- * @param numBuffers the number of buffers.
- * @param caps the BufferCapabilities.
- *
- * @throws AWTException if the capabilities supplied could not
- * be supported or met.
+ * @param numBuffers
+ * the number of buffers.
+ * @param caps
+ * the BufferCapabilities.
+ * @throws AWTException
+ * if the capabilities supplied could not be supported or
+ * met.
*/
- protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
- throws AWTException {
- //???AWT
+ protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps) throws AWTException {
+ // ???AWT
/*
- if (!(Component.this instanceof Window) && !(Component.this instanceof Canvas)) {
- // awt.14B=Only Canvas or Window is allowed
- throw new ClassCastException(Messages.getString("awt.14B")); //$NON-NLS-1$
- }
- */
+ * if (!(Component.this instanceof Window) && !(Component.this
+ * instanceof Canvas)) { // awt.14B=Only Canvas or Window is allowed
+ * throw new ClassCastException(Messages.getString("awt.14B"));
+ * //$NON-NLS-1$ }
+ */
// TODO: throw new AWTException("Capabilities are not supported");
this.numBuffers = numBuffers;
- this.caps = (BufferCapabilities) caps.clone();
+ this.caps = (BufferCapabilities)caps.clone();
}
/**
- * Returns true if the drawing buffer has been lost since the last call
- * to getDrawGraphics.
- *
- * @return true if the drawing buffer has been lost since the last call
- * to getDrawGraphics, false otherwise.
+ * Returns true if the drawing buffer has been lost since the last call
+ * to getDrawGraphics.
*
+ * @return true if the drawing buffer has been lost since the last call
+ * to getDrawGraphics, false otherwise.
* @see java.awt.image.BufferStrategy#contentsLost()
*/
@Override
@@ -773,9 +509,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* state and reinitialized to the default background color.
*
* @return true if the drawing buffer has been restored from a lost
- * state and reinitialized to the default background color,
- * false otherwise.
- *
+ * state and reinitialized to the default background color,
+ * false otherwise.
* @see java.awt.image.BufferStrategy#contentsRestored()
*/
@Override
@@ -789,14 +524,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Creates flipping buffers with the specified buffer capabilities.
*
- * @param numBuffers the number of buffers.
- * @param caps the BufferCapabilities.
- *
- * @throws AWTException if the capabilities could not be
- * supported or met.
+ * @param numBuffers
+ * the number of buffers.
+ * @param caps
+ * the BufferCapabilities.
+ * @throws AWTException
+ * if the capabilities could not be supported or met.
*/
- protected void createBuffers(int numBuffers, BufferCapabilities caps)
- throws AWTException {
+ protected void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException {
if (numBuffers < 2) {
// awt.14C=Number of buffers must be greater than one
throw new IllegalArgumentException(Messages.getString("awt.14C")); //$NON-NLS-1$
@@ -827,7 +562,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Flips the contents of the back buffer to the front buffer.
*
- * @param flipAction the flip action.
+ * @param flipAction
+ * the flip action.
*/
protected void flip(BufferCapabilities.FlipContents flipAction) {
if (true) {
@@ -851,19 +587,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Returns the BufferCapabilities of the buffer strategy.
*
* @return the BufferCapabilities.
- *
* @see java.awt.image.BufferStrategy#getCapabilities()
*/
@Override
public BufferCapabilities getCapabilities() {
- return (BufferCapabilities) caps.clone();
+ return (BufferCapabilities)caps.clone();
}
/**
* Gets Graphics of current buffer strategy.
*
* @return the Graphics of current buffer strategy.
- *
* @see java.awt.image.BufferStrategy#getDrawGraphics()
*/
@Override
@@ -900,14 +634,16 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* The internal component's state utilized by the visual theme.
*/
class ComponentState implements State {
-
- /** The default minimum size. */
+
+ /**
+ * The default minimum size.
+ */
private Dimension defaultMinimumSize = new Dimension();
/**
* Checks if the component is enabled.
*
- * @return true, if the component is enabled
+ * @return true, if the component is enabled.
*/
public boolean isEnabled() {
return enabled;
@@ -916,7 +652,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if the component is visible.
*
- * @return true, if the component is visible
+ * @return true, if the component is visible.
*/
public boolean isVisible() {
return visible;
@@ -925,17 +661,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if is focused.
*
- * @return true, if is focused
+ * @return true, if is focused.
*/
public boolean isFocused() {
- //???AWT: return isFocusOwner();
+ // ???AWT: return isFocusOwner();
return false;
}
/**
* Gets the font.
*
- * @return the font
+ * @return the font.
*/
public Font getFont() {
return Component.this.getFont();
@@ -944,7 +680,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if the font has been set.
*
- * @return true, if the font has been set
+ * @return true, if the font has been set.
*/
public boolean isFontSet() {
return font != null;
@@ -953,7 +689,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the background color.
*
- * @return the background color
+ * @return the background color.
*/
public Color getBackground() {
Color c = Component.this.getBackground();
@@ -963,7 +699,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if the background is set.
*
- * @return true, if the background is set
+ * @return true, if the background is set.
*/
public boolean isBackgroundSet() {
return backColor != null;
@@ -972,7 +708,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the text color.
*
- * @return the text color
+ * @return the text color.
*/
public Color getTextColor() {
Color c = getForeground();
@@ -982,7 +718,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if the text color is set.
*
- * @return true, if the text color is set
+ * @return true, if the text color is set.
*/
public boolean isTextColorSet() {
return foreColor != null;
@@ -991,7 +727,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the font metrics.
*
- * @return the font metrics
+ * @return the font metrics.
*/
@SuppressWarnings("deprecation")
public FontMetrics getFontMetrics() {
@@ -1001,7 +737,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the bounding rectangle.
*
- * @return the bounding rectangle
+ * @return the bounding rectangle.
*/
public Rectangle getBounds() {
return new Rectangle(x, y, w, h);
@@ -1010,7 +746,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the size of the bounding rectangle.
*
- * @return the size of the bounding rectangle
+ * @return the size of the bounding rectangle.
*/
public Dimension getSize() {
return new Dimension(w, h);
@@ -1019,7 +755,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the window id.
*
- * @return the window id
+ * @return the window id.
*/
public long getWindowId() {
NativeWindow win = getNativeWindow();
@@ -1029,7 +765,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the default minimum size.
*
- * @return the default minimum size
+ * @return the default minimum size.
*/
public Dimension getDefaultMinimumSize() {
if (defaultMinimumSize == null) {
@@ -1041,7 +777,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the default minimum size.
*
- * @param size the new default minimum size
+ * @param size
+ * the new default minimum size.
*/
public void setDefaultMinimumSize(Dimension size) {
defaultMinimumSize = size;
@@ -1062,179 +799,283 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT: private transient AccessibleContext accessibleContext;
+ // ???AWT: private transient AccessibleContext accessibleContext;
- /** The behaviour. */
+ /**
+ * The behaviour.
+ */
final transient ComponentBehavior behaviour;
- //???AWT: Container parent;
+ // ???AWT: Container parent;
- /** The name. */
+ /**
+ * The name.
+ */
private String name;
- /** The auto name. */
+ /**
+ * The auto name.
+ */
private boolean autoName = true;
- /** The font. */
+ /**
+ * The font.
+ */
private Font font;
- /** The back color. */
+ /**
+ * The back color.
+ */
private Color backColor;
- /** The fore color. */
+ /**
+ * The fore color.
+ */
private Color foreColor;
- /** The deprecated event handler. */
+ /**
+ * The deprecated event handler.
+ */
boolean deprecatedEventHandler = true;
- /** The enabled events. */
+ /**
+ * The enabled events.
+ */
private long enabledEvents;
- /** The enabled awt events. */
+ /**
+ * The enabled AWT events.
+ */
private long enabledAWTEvents;
- /** The component listeners. */
+ /**
+ * The component listeners.
+ */
private final AWTListenerList componentListeners = new AWTListenerList(
this);
- /** The focus listeners. */
+ /**
+ * The focus listeners.
+ */
private final AWTListenerList focusListeners = new AWTListenerList(
this);
- /** The hierarchy listeners. */
+ /**
+ * The hierarchy listeners.
+ */
private final AWTListenerList hierarchyListeners = new AWTListenerList(
this);
- /** The hierarchy bounds listeners. */
+ /**
+ * The hierarchy bounds listeners.
+ */
private final AWTListenerList hierarchyBoundsListeners = new AWTListenerList(
this);
- /** The key listeners. */
- private final AWTListenerList keyListeners = new AWTListenerList(
- this);
+ /**
+ * The key listeners.
+ */
+ private final AWTListenerList keyListeners = new AWTListenerList(this);
- /** The mouse listeners. */
+ /**
+ * The mouse listeners.
+ */
private final AWTListenerList mouseListeners = new AWTListenerList(
this);
- /** The mouse motion listeners. */
+ /**
+ * The mouse motion listeners.
+ */
private final AWTListenerList mouseMotionListeners = new AWTListenerList(
this);
- /** The mouse wheel listeners. */
+ /**
+ * The mouse wheel listeners.
+ */
private final AWTListenerList mouseWheelListeners = new AWTListenerList(
this);
- /** The input method listeners. */
+ /**
+ * The input method listeners.
+ */
private final AWTListenerList inputMethodListeners = new AWTListenerList(
this);
- /** The x. */
+ /**
+ * The x.
+ */
int x;
- /** The y. */
+ /**
+ * The y.
+ */
int y;
- /** The w. */
+ /**
+ * The w.
+ */
int w;
- /** The h. */
+ /**
+ * The h.
+ */
int h;
- /** The maximum size. */
+ /**
+ * The maximum size.
+ */
private Dimension maximumSize;
- /** The minimum size. */
+ /**
+ * The minimum size.
+ */
private Dimension minimumSize;
- /** The preferred size. */
+ /**
+ * The preferred size.
+ */
private Dimension preferredSize;
- /** The bounds mask param. */
+ /**
+ * The bounds mask param.
+ */
private int boundsMaskParam;
- /** The ignore repaint. */
+ /**
+ * The ignore repaint.
+ */
private boolean ignoreRepaint;
- /** The enabled. */
+ /**
+ * The enabled.
+ */
private boolean enabled = true;
- /** The input methods enabled. */
+ /**
+ * The input methods enabled.
+ */
private boolean inputMethodsEnabled = true;
- /** The dispatch to im. */
+ /**
+ * The dispatch to im.
+ */
transient boolean dispatchToIM = true;
- /** The focusable. */
+ /**
+ * The focusable.
+ */
private boolean focusable = true; // By default, all Components return
// true from isFocusable() method
- /** The visible. */
+ /**
+ * The visible.
+ */
boolean visible = true;
- /** The called set focusable. */
+ /**
+ * The called set focusable.
+ */
private boolean calledSetFocusable;
- /** The overriden is focusable. */
+ /**
+ * The overridden is focusable.
+ */
private boolean overridenIsFocusable = true;
- /** The focus traversal keys enabled. */
+ /**
+ * The focus traversal keys enabled.
+ */
private boolean focusTraversalKeysEnabled = true;
- /** Possible keys are: FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS, UP_CYCLE_TRAVERSAL_KEYS. */
+ /**
+ * Possible keys are: FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS,
+ * UP_CYCLE_TRAVERSAL_KEYS.
+ */
private final Map> traversalKeys = new HashMap>();
- /** The traversal i ds. */
+ /**
+ * The traversal i ds.
+ */
int[] traversalIDs;
- /** The locale. */
+ /**
+ * The locale.
+ */
private Locale locale;
- /** The orientation. */
+ /**
+ * The orientation.
+ */
private ComponentOrientation orientation;
- /** The property change support. */
+ /**
+ * The property change support.
+ */
private PropertyChangeSupport propertyChangeSupport;
- //???AWT: private ArrayList popups;
+ // ???AWT: private ArrayList popups;
- /** The coalescer. */
+ /**
+ * The coalescer.
+ */
private boolean coalescer;
- /** The events table. */
+ /**
+ * The events table.
+ */
private Hashtable> eventsTable;
- /** Cashed reference used during EventQueue.postEvent() */
+ /**
+ * Cashed reference used during EventQueue.postEvent()
+ */
private LinkedList eventsList;
- /** The hierarchy changing counter. */
+ /**
+ * The hierarchy changing counter.
+ */
private int hierarchyChangingCounter;
- /** The was showing. */
+ /**
+ * The was showing.
+ */
private boolean wasShowing;
- /** The was displayable. */
+ /**
+ * The was displayable.
+ */
private boolean wasDisplayable;
- /** The cursor. */
+ /**
+ * The cursor.
+ */
Cursor cursor;
- //???AWT: DropTarget dropTarget;
+ // ???AWT: DropTarget dropTarget;
- /** The mouse exited expected. */
+ /**
+ * The mouse exited expected.
+ */
private boolean mouseExitedExpected;
- /** The repaint region. */
+ /**
+ * The repaint region.
+ */
transient MultiRectArea repaintRegion;
- //???AWT: transient RedrawManager redrawManager;
- /** The redraw manager. */
+ // ???AWT: transient RedrawManager redrawManager;
+ /**
+ * The redraw manager.
+ */
transient Object redrawManager;
- /** The valid. */
+ /**
+ * The valid.
+ */
private boolean valid;
- /** The updated images. */
+ /**
+ * The updated images.
+ */
private HashMap updatedImages;
/**
@@ -1244,7 +1085,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
private class ComponentLock {
}
- /** The component lock. */
+ /**
+ * The component lock.
+ */
private final transient Object componentLock = new ComponentLock();
static {
PrivilegedAction action = new PrivilegedAction() {
@@ -1276,17 +1119,16 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
try {
orientation = ComponentOrientation.UNKNOWN;
redrawManager = null;
- //???AWT
+ // ???AWT
/*
- traversalIDs = this instanceof Container ? KeyboardFocusManager.contTraversalIDs
- : KeyboardFocusManager.compTraversalIDs;
- for (int element : traversalIDs) {
- traversalKeys.put(new Integer(element), null);
- }
- behaviour = createBehavior();
- */
+ * traversalIDs = this instanceof Container ?
+ * KeyboardFocusManager.contTraversalIDs :
+ * KeyboardFocusManager.compTraversalIDs; for (int element :
+ * traversalIDs) { traversalKeys.put(new Integer(element), null); }
+ * behaviour = createBehavior();
+ */
behaviour = null;
-
+
deriveCoalescerFlag();
} finally {
toolkit.unlockAWT();
@@ -1307,8 +1149,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
for (Class> c = thisClass; c != Component.class; c = c.getSuperclass()) {
try {
coalesceMethod = c.getDeclaredMethod("coalesceEvents", new Class[] { //$NON-NLS-1$
- Class.forName("java.awt.AWTEvent"), //$NON-NLS-1$
- Class.forName("java.awt.AWTEvent") }); //$NON-NLS-1$
+ Class.forName("java.awt.AWTEvent"), //$NON-NLS-1$
+ Class.forName("java.awt.AWTEvent")}); //$NON-NLS-1$
} catch (Exception e) {
}
if (coalesceMethod != null) {
@@ -1332,7 +1174,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the name of the Component.
*
- * @param name the new name of the Component.
+ * @param name
+ * the new name of the Component.
*/
public void setName(String name) {
String oldName;
@@ -1367,15 +1210,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Auto name.
*
- * @return the string
+ * @return the string.
*/
String autoName() {
String name = getClass().getName();
if (name.indexOf("$") != -1) { //$NON-NLS-1$
return null;
}
- //???AWT
- //int number = toolkit.autoNumber.nextComponent++;
+ // ???AWT
+ // int number = toolkit.autoNumber.nextComponent++;
int number = 0;
name = name.substring(name.lastIndexOf(".") + 1) + Integer.toString(number); //$NON-NLS-1$
return name;
@@ -1390,10 +1233,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
public String toString() {
/*
* The format is based on 1.5 release behavior which can be revealed by
- * the following code:
- *
- * Component c = new Component(){}; c.setVisible(false);
- * System.out.println(c);
+ * the following code: Component c = new Component(){};
+ * c.setVisible(false); System.out.println(c);
*/
toolkit.lockAWT();
try {
@@ -1403,32 +1244,21 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT
+ // ???AWT
/*
- public void add(PopupMenu popup) {
- toolkit.lockAWT();
- try {
- if (popup.getParent() == this) {
- return;
- }
- if (popups == null) {
- popups = new ArrayList();
- }
- popup.setParent(this);
- popups.add(popup);
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
+ * public void add(PopupMenu popup) { toolkit.lockAWT(); try { if
+ * (popup.getParent() == this) { return; } if (popups == null) { popups =
+ * new ArrayList(); } popup.setParent(this); popups.add(popup); }
+ * finally { toolkit.unlockAWT(); } }
+ */
/**
* Returns true, if the component contains the specified Point.
*
- * @param p the Point.
- *
- * @return true, if the component contains the specified Point,
- * false otherwise.
+ * @param p
+ * the Point.
+ * @return true, if the component contains the specified Point, false
+ * otherwise.
*/
public boolean contains(Point p) {
toolkit.lockAWT();
@@ -1440,14 +1270,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Returns true, if the component contains the point with
- * the specified coordinates.
+ * Returns true, if the component contains the point with the specified
+ * coordinates.
*
- * @param x the x coordinate.
- * @param y the y coordinate.
- *
- * @return true, if the component contains the point with
- * the specified coordinates, false otherwise.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
+ * @return true, if the component contains the point with the specified
+ * coordinates, false otherwise.
*/
public boolean contains(int x, int y) {
toolkit.lockAWT();
@@ -1462,7 +1293,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Deprecated: replaced by replaced by getSize() method.
*
* @return the dimension.
- *
* @deprecated Replaced by getSize() method.
*/
@Deprecated
@@ -1474,90 +1304,63 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
toolkit.unlockAWT();
}
}
-
- //???AWT
+
+ // ???AWT
/*
- public Container getParent() {
- toolkit.lockAWT();
- try {
- return parent;
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
-
+ * public Container getParent() { toolkit.lockAWT(); try { return parent; }
+ * finally { toolkit.unlockAWT(); } }
+ */
+
/**
* List.
*
- * @param out the out
- * @param indent the indent
- *
+ * @param out
+ * the out.
+ * @param indent
+ * the indent
* @return the nearest heavyweight ancestor in hierarchy or
- * null if not found
+ * null if not found.
*/
- //???AWT
+ // ???AWT
/*
- Component getHWAncestor() {
- return (parent != null ? parent.getHWSurface() : null);
- }
- */
-
+ * Component getHWAncestor() { return (parent != null ?
+ * parent.getHWSurface() : null); }
+ */
+
/**
* @return heavyweight component that is equal to or is a nearest
* heavyweight container of the current component, or
- * null if not found
+ * null if not found.
*/
- //???AWT
+ // ???AWT
/*
- Component getHWSurface() {
- Component parent;
- for (parent = this; (parent != null) && (parent.isLightweight()); parent = parent
- .getParent()) {
- ;
- }
- return parent;
- }
+ * Component getHWSurface() { Component parent; for (parent = this; (parent
+ * != null) && (parent.isLightweight()); parent = parent .getParent()) { ; }
+ * return parent; } Window getWindowAncestor() { Component par; for (par =
+ * this; par != null && !(par instanceof Window); par = par.getParent()) { ;
+ * } return (Window) par; }
+ */
- Window getWindowAncestor() {
- Component par;
- for (par = this; par != null && !(par instanceof Window); par = par.getParent()) {
- ;
- }
- return (Window) par;
- }
- */
-
- /** To be called by container */
- //???AWT
+ /**
+ * To be called by container
+ */
+ // ???AWT
/*
- void setParent(Container parent) {
- this.parent = parent;
- setRedrawManager();
- }
-
- void setRedrawManager() {
- redrawManager = getRedrawManager();
- }
-
- public void remove(MenuComponent menu) {
- toolkit.lockAWT();
- try {
- if (menu.getParent() == this) {
- menu.setParent(null);
- popups.remove(menu);
- }
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
+ * void setParent(Container parent) { this.parent = parent;
+ * setRedrawManager(); } void setRedrawManager() { redrawManager =
+ * getRedrawManager(); } public void remove(MenuComponent menu) {
+ * toolkit.lockAWT(); try { if (menu.getParent() == this) {
+ * menu.setParent(null); popups.remove(menu); } } finally {
+ * toolkit.unlockAWT(); } }
+ */
/**
- * Prints a list of this component with the specified number of
- * leading whitespace characters to the specified PrintStream.
+ * Prints a list of this component with the specified number of leading
+ * whitespace characters to the specified PrintStream.
*
- * @param out the output PrintStream object.
- * @param indent how many leading whitespace characters to prepend
+ * @param out
+ * the output PrintStream object.
+ * @param indent
+ * how many leading whitespace characters to prepend.
*/
public void list(PrintStream out, int indent) {
toolkit.lockAWT();
@@ -1571,7 +1374,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Prints a list of this component to the specified PrintWriter.
*
- * @param out the output PrintWriter object.
+ * @param out
+ * the output PrintWriter object.
*/
public void list(PrintWriter out) {
toolkit.lockAWT();
@@ -1583,11 +1387,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Prints a list of this component with the specified number of
- * leading whitespace characters to the specified PrintWriter.
+ * Prints a list of this component with the specified number of leading
+ * whitespace characters to the specified PrintWriter.
*
- * @param out the output PrintWriter object.
- * @param indent how many leading whitespace characters to prepend
+ * @param out
+ * the output PrintWriter object.
+ * @param indent
+ * how many leading whitespace characters to prepend.
*/
public void list(PrintWriter out, int indent) {
toolkit.lockAWT();
@@ -1599,13 +1405,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets a string composed of the desired number of
- * whitespace characters.
+ * Gets a string composed of the desired number of whitespace characters.
*
- * @param indent the length of the String to return
- *
- * @return the string composed of the desired number of
- * whitespace characters
+ * @param indent
+ * the length of the String to return.
+ * @return the string composed of the desired number of whitespace
+ * characters.
*/
String getIndentStr(int indent) {
char[] ind = new char[indent];
@@ -1616,9 +1421,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Prints a list of this component to the specified PrintStream
+ * Prints a list of this component to the specified PrintStream.
*
- * @param out the output PrintStream object.
+ * @param out
+ * the output PrintStream object.
*/
public void list(PrintStream out) {
toolkit.lockAWT();
@@ -1631,8 +1437,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Prints a list of this component to the standard system
- * output stream.
+ * Prints a list of this component to the standard system output stream.
*/
public void list() {
toolkit.lockAWT();
@@ -1644,9 +1449,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Prints this component.
+ * Prints this component.
*
- * @param g the Graphics to be used for painting.
+ * @param g
+ * the Graphics to be used for painting.
*/
public void print(Graphics g) {
toolkit.lockAWT();
@@ -1660,7 +1466,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Prints the component and all of its subcomponents.
*
- * @param g the Graphics to be used for painting.
+ * @param g
+ * the Graphics to be used for painting.
*/
public void printAll(Graphics g) {
toolkit.lockAWT();
@@ -1672,11 +1479,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Sets the size of the Component specified by width and height
- * parameters.
+ * Sets the size of the Component specified by width and height parameters.
*
- * @param width the width of the Component.
- * @param height the height of the Component.
+ * @param width
+ * the width of the Component.
+ * @param height
+ * the height of the Component.
*/
public void setSize(int width, int height) {
toolkit.lockAWT();
@@ -1690,7 +1498,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the size of the Component specified by Dimension object.
*
- * @param d the new size of the Component.
+ * @param d
+ * the new size of the Component.
*/
public void setSize(Dimension d) {
toolkit.lockAWT();
@@ -1704,9 +1513,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by setSize(int, int) method.
*
- * @param width the width.
- * @param height the height.
- *
+ * @param width
+ * the width.
+ * @param height
+ * the height.
* @deprecated Replaced by setSize(int, int) method.
*/
@Deprecated
@@ -1723,8 +1533,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by setSize(int, int) method.
*
- * @param size the size.
- *
+ * @param size
+ * the size.
* @deprecated Replaced by setSize(int, int) method.
*/
@Deprecated
@@ -1740,8 +1550,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks whether or not this component is completely opaque.
*
- * @return true, if this component is completely opaque,
- * false by default.
+ * @return true, if this component is completely opaque, false by default.
*/
public boolean isOpaque() {
toolkit.lockAWT();
@@ -1765,7 +1574,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
} finally {
toolkit.unlockAWT();
}
- //???AWT: fireAccessibleStateChange(AccessibleState.ENABLED, false);
+ // ???AWT: fireAccessibleStateChange(AccessibleState.ENABLED, false);
}
/**
@@ -1781,15 +1590,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
} finally {
toolkit.unlockAWT();
}
- //???AWT: fireAccessibleStateChange(AccessibleState.ENABLED, true);
+ // ???AWT: fireAccessibleStateChange(AccessibleState.ENABLED, true);
}
/**
* Enables or disable this component.
*
- * @param b the boolean parameter.
- *
- * @deprecated Replaced by setEnabled(boolean) method.
+ * @param b
+ * the boolean parameter.
+ * @deprecated Replaced by setEnabled(boolean) method.
*/
@Deprecated
public void enable(boolean b) {
@@ -1809,9 +1618,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Stores the location of this component to the specified Point object;
* returns the point of the component's top-left corner.
*
- * @param rv the Point object where the component's top-left corner
- * position will be stored.
- *
+ * @param rv
+ * the Point object where the component's top-left corner
+ * position will be stored.
* @return the Point which specifies the component's top-left corner.
*/
public Point getLocation(Point rv) {
@@ -1828,8 +1637,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets the location of this component on the form;
- * returns the point of the component's top-left corner.
+ * Gets the location of this component on the form; returns the point of the
+ * component's top-left corner.
*
* @return the Point which specifies the component's top-left corner.
*/
@@ -1857,12 +1666,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Stores the size of this Component to the specified Dimension
- * object.
- *
- * @param rv the Dimension object where the size of the Component
- * will be stored.
+ * Stores the size of this Component to the specified Dimension object.
*
+ * @param rv
+ * the Dimension object where the size of the Component will be
+ * stored.
* @return the Dimension of this Component.
*/
public Dimension getSize(Dimension rv) {
@@ -1879,9 +1687,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Checks whether or not this Component is valid. A component is valid
- * if it is correctly sized and positioned within its parent container
- * and all its children are also valid.
+ * Checks whether or not this Component is valid. A component is valid if it
+ * is correctly sized and positioned within its parent container and all its
+ * children are also valid.
*
* @return true, if the Component is valid, false otherwise.
*/
@@ -1898,7 +1706,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Deprecated: replaced by getComponentAt(int, int) method.
*
* @return the Point.
- *
* @deprecated Replaced by getComponentAt(int, int) method.
*/
@Deprecated
@@ -1912,7 +1719,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Connects this Component to a native screen resource and makes it
+ * Connects this Component to a native screen resource and makes it
* displayable. This method not be called directly by user applications.
*/
public void addNotify() {
@@ -1920,11 +1727,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
try {
prepare4HierarchyChange();
behaviour.addNotify();
- //???AWT
-// finishHierarchyChange(this, parent, 0);
-// if (dropTarget != null) {
-// dropTarget.addNotify(peer);
-// }
+ // ???AWT
+ // finishHierarchyChange(this, parent, 0);
+ // if (dropTarget != null) {
+ // dropTarget.addNotify(peer);
+ // }
} finally {
toolkit.unlockAWT();
}
@@ -1933,45 +1740,32 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Map to display.
*
- * @param b the b
+ * @param b
+ * the b.
*/
void mapToDisplay(boolean b) {
- //???AWT
+ // ???AWT
/*
- if (b && !isDisplayable()) {
- if ((this instanceof Window) || ((parent != null) && parent.isDisplayable())) {
- addNotify();
- }
- } else if (!b && isDisplayable()) {
- removeNotify();
- }
- */
+ * if (b && !isDisplayable()) { if ((this instanceof Window) || ((parent
+ * != null) && parent.isDisplayable())) { addNotify(); } } else if (!b
+ * && isDisplayable()) { removeNotify(); }
+ */
}
/**
* Gets the toolkit.
*
- * @return accessible context specific for particular component
+ * @return accessible context specific for particular component.
*/
- //???AWT
+ // ???AWT
/*
- AccessibleContext createAccessibleContext() {
- return null;
- }
+ * AccessibleContext createAccessibleContext() { return null; } public
+ * AccessibleContext getAccessibleContext() { toolkit.lockAWT(); try { if
+ * (accessibleContext == null) { accessibleContext =
+ * createAccessibleContext(); } return accessibleContext; } finally {
+ * toolkit.unlockAWT(); } }
+ */
- public AccessibleContext getAccessibleContext() {
- toolkit.lockAWT();
- try {
- if (accessibleContext == null) {
- accessibleContext = createAccessibleContext();
- }
- return accessibleContext;
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
-
/**
* Gets Toolkit for the current Component.
*
@@ -1982,8 +1776,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets this component's locking object for AWT component tree
- * and layout operations.
+ * Gets this component's locking object for AWT component tree and layout
+ * operations.
*
* @return the tree locking object.
*/
@@ -1992,12 +1786,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * @param evt the Event.
- * @param what the event's key.
+ * Handles the event. Use ActionListener instead of this.
*
+ * @param evt
+ * the Event.
+ * @param what
+ * the event's key.
* @return true, if successful.
- *
- * @deprecated Use ActionListener class for registering event listener.
+ * @deprecated Use ActionListener class for registering event listener.
*/
@Deprecated
public boolean action(Event evt, Object what) {
@@ -2006,11 +1802,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
return false;
}
-
/**
* Gets the property change support.
*
- * @return the property change support
+ * @return the property change support.
*/
private PropertyChangeSupport getPropertyChangeSupport() {
synchronized (componentLock) {
@@ -2020,36 +1815,29 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
return propertyChangeSupport;
}
}
-
- //???AWT
- /*
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- getPropertyChangeSupport().addPropertyChangeListener(listener);
- }
-
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- getPropertyChangeSupport().addPropertyChangeListener(propertyName, listener);
- }
- public void applyComponentOrientation(ComponentOrientation orientation) {
- toolkit.lockAWT();
- try {
- setComponentOrientation(orientation);
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
+ // ???AWT
+ /*
+ * public void addPropertyChangeListener(PropertyChangeListener listener) {
+ * getPropertyChangeSupport().addPropertyChangeListener(listener); } public
+ * void addPropertyChangeListener(String propertyName,
+ * PropertyChangeListener listener) {
+ * getPropertyChangeSupport().addPropertyChangeListener(propertyName,
+ * listener); } public void applyComponentOrientation(ComponentOrientation
+ * orientation) { toolkit.lockAWT(); try {
+ * setComponentOrientation(orientation); } finally { toolkit.unlockAWT(); }
+ * }
+ */
/**
- * Returns true if the set of focus traversal keys for the given focus
- * traversal operation has been explicitly defined for this Component.
- *
- * @param id the ID of traversal key.
+ * Returns true if the set of focus traversal keys for the given focus
+ * traversal operation has been explicitly defined for this Component.
*
- * @return true, if the set of focus traversal keys for the given focus
- * traversal operation has been explicitly defined for this Component,
- * false otherwise.
+ * @param id
+ * the ID of traversal key.
+ * @return true, if the set of focus traversal keys for the given focus.
+ * traversal operation has been explicitly defined for this
+ * Component, false otherwise.
*/
public boolean areFocusTraversalKeysSet(int id) {
toolkit.lockAWT();
@@ -2069,7 +1857,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Gets the bounds of the Component.
*
* @return the rectangle bounds of the Component.
- *
* @deprecated Use getBounds() methood.
*/
@Deprecated
@@ -2083,16 +1870,20 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Returns the construction status of a specified image
- * with the specified width and height that is being created.
- *
- *
- * @param image the image to be checked.
- * @param width the width of scaled image which status is being checked, or -1.
- * @param height the height of scaled image which status is being checked, or -1.
- * @param observer the ImageObserver object to be notified while
- * the image is being prepared.
+ * Returns the construction status of a specified image with the specified
+ * width and height that is being created.
*
+ * @param image
+ * the image to be checked.
+ * @param width
+ * the width of scaled image which status is being checked, or
+ * -1.
+ * @param height
+ * the height of scaled image which status is being checked, or
+ * -1.
+ * @param observer
+ * the ImageObserver object to be notified while the image is
+ * being prepared.
* @return the ImageObserver flags of the current state of the image data.
*/
public int checkImage(Image image, int width, int height, ImageObserver observer) {
@@ -2105,13 +1896,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Returns the construction status of a specified image that is being created.
- *
- *
- * @param image the image to be checked.
- * @param observer the ImageObserver object to be notified while
- * the image is being prepared.
+ * Returns the construction status of a specified image that is being
+ * created.
*
+ * @param image
+ * the image to be checked.
+ * @param observer
+ * the ImageObserver object to be notified while the image is
+ * being prepared.
* @return the ImageObserver flags of the current state of the image data.
*/
public int checkImage(Image image, ImageObserver observer) {
@@ -2126,10 +1918,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Coalesces the existed event with new event.
*
- * @param existingEvent the existing event in the EventQueue.
- * @param newEvent the new event to be posted to the EventQueue.
- *
- * @return the coalesced AWTEvent, or null if there is no coalescing done.
+ * @param existingEvent
+ * the existing event in the EventQueue.
+ * @param newEvent
+ * the new event to be posted to the EventQueue.
+ * @return the coalesced AWTEvent, or null if there is no coalescing done.
*/
protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent) {
toolkit.lockAWT();
@@ -2147,7 +1940,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if this Component is a coalescer.
*
- * @return true, if is coalescer
+ * @return true, if is coalescer.
*/
boolean isCoalescer() {
return coalescer;
@@ -2156,9 +1949,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the relative event.
*
- * @param id the id
- *
- * @return the relative event
+ * @param id
+ * the id.
+ * @return the relative event.
*/
AWTEvent getRelativeEvent(int id) {
Integer idWrapper = new Integer(id);
@@ -2177,7 +1970,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the new event.
*
- * @param event the event
+ * @param event
+ * the event.
*/
void addNewEvent(AWTEvent event) {
eventsList.addLast(event);
@@ -2193,7 +1987,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the next event.
*
- * @param id the id
+ * @param id
+ * the id.
*/
void removeNextEvent(int id) {
eventsTable.get(new Integer(id)).removeFirst();
@@ -2202,8 +1997,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Creates the image with the specified ImageProducer.
*
- * @param producer the ImageProducer to be used for image creation.
- *
+ * @param producer
+ * the ImageProducer to be used for image creation.
* @return the image with the specified ImageProducer.
*/
public Image createImage(ImageProducer producer) {
@@ -2218,11 +2013,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Creates an off-screen drawable image to be used for double buffering.
*
- * @param width the width of the image.
- * @param height the height of the image.
- *
- * @return the off-screen drawable image or null if the component is not
- * displayable or GraphicsEnvironment.isHeadless() method returns true.
+ * @param width
+ * the width of the image.
+ * @param height
+ * the height of the image.
+ * @return the off-screen drawable image or null if the component is not
+ * displayable or GraphicsEnvironment.isHeadless() method returns
+ * true.
*/
public Image createImage(int width, int height) {
toolkit.lockAWT();
@@ -2245,17 +2042,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Creates an off-screen drawable image with the specified width,
- * height and ImageCapabilities.
- *
- * @param width the width
- * @param height the height
- * @param caps the ImageCapabilities.
+ * Creates an off-screen drawable image with the specified width, height and
+ * ImageCapabilities.
*
- * @return the volatile image
- *
- * @throws AWTException if an image with the specified capabilities
- * cannot be created.
+ * @param width
+ * the width.
+ * @param height
+ * the height.
+ * @param caps
+ * the ImageCapabilities.
+ * @return the volatile image.
+ * @throws AWTException
+ * if an image with the specified capabilities cannot be
+ * created.
*/
public VolatileImage createVolatileImage(int width, int height, ImageCapabilities caps)
throws AWTException {
@@ -2277,16 +2076,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Creates a volatile off-screen drawable image which is used
- * for double buffering.
- *
- * @param width the width of image.
- * @param height the height of image.
+ * Creates a volatile off-screen drawable image which is used for double
+ * buffering.
*
- * @return the volatile image a volatile off-screen drawable image
- * which is used for double buffering or null if the component
- * is not displayable, or GraphicsEnvironment.isHeadless() method
- * returns true.
+ * @param width
+ * the width of image.
+ * @param height
+ * the height of image.
+ * @return the volatile image a volatile off-screen drawable image which is
+ * used for double buffering or null if the component is not
+ * displayable, or GraphicsEnvironment.isHeadless() method returns
+ * true.
*/
public VolatileImage createVolatileImage(int width, int height) {
toolkit.lockAWT();
@@ -2311,9 +2111,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* with the component's background color to prepare it for double-buffered
* painting.
*
- * @param image the image
- * @param width the width
- * @param height the height
+ * @param image
+ * the image.
+ * @param width
+ * the width.
+ * @param height
+ * the height.
*/
private void fillImageBackground(Image image, int width, int height) {
Graphics gr = image.getGraphics();
@@ -2325,8 +2128,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Delivers event.
*
- * @param evt the event.
- *
+ * @param evt
+ * the event.
* @deprecated Replaced by dispatchEvent(AWTEvent e) method.
*/
@Deprecated
@@ -2335,7 +2138,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Prompts the layout manager to lay out this component.
+ * Prompts the layout manager to lay out this component.
*/
public void doLayout() {
toolkit.lockAWT();
@@ -2350,9 +2153,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Fire property change impl.
*
- * @param propertyName the property name
- * @param oldValue the old value
- * @param newValue the new value
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old value.
+ * @param newValue
+ * the new value.
*/
private void firePropertyChangeImpl(String propertyName, Object oldValue, Object newValue) {
PropertyChangeSupport pcs;
@@ -2368,32 +2174,40 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Reports a bound property changes for int properties.
*
- * @param propertyName the property name.
- * @param oldValue the old property's value.
- * @param newValue the new property's value.
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old property's value.
+ * @param newValue
+ * the new property's value.
*/
protected void firePropertyChange(String propertyName, int oldValue, int newValue) {
firePropertyChangeImpl(propertyName, new Integer(oldValue), new Integer(newValue));
}
/**
- * Report a bound property change for a boolean-valued property.
- *
- * @param propertyName the property name.
- * @param oldValue the property's old value.
- * @param newValue the property's new value.
+ * Report a bound property change for a boolean-valued property.
+ *
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the property's old value.
+ * @param newValue
+ * the property's new value.
*/
protected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
- firePropertyChangeImpl(propertyName, Boolean.valueOf(oldValue), Boolean
- .valueOf(newValue));
+ firePropertyChangeImpl(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
}
/**
- * Reports a bound property change for an Object-valued property.
+ * Reports a bound property change for an Object-valued property.
*
- * @param propertyName the property name.
- * @param oldValue the property's old value
- * @param newValue the property's new value
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the property's old value.
+ * @param newValue
+ * the property's new value.
*/
protected void firePropertyChange(final String propertyName, final Object oldValue,
final Object newValue) {
@@ -2401,75 +2215,93 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Report a bound property change for a byte-valued property.
+ * Report a bound property change for a byte-valued property.
*
- * @param propertyName the property name.
- * @param oldValue the property's old value.
- * @param newValue the property's new value.
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the property's old value.
+ * @param newValue
+ * the property's new value.
*/
public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {
firePropertyChangeImpl(propertyName, new Byte(oldValue), new Byte(newValue));
}
/**
- * Report a bound property change for a char-valued property.
+ * Report a bound property change for a char-valued property.
*
- * @param propertyName the property name.
- * @param oldValue the old property's value.
- * @param newValue the new property's value.
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old property's value.
+ * @param newValue
+ * the new property's value.
*/
public void firePropertyChange(String propertyName, char oldValue, char newValue) {
firePropertyChangeImpl(propertyName, new Character(oldValue), new Character(newValue));
}
/**
- * Report a bound property change for a short-valued property.
+ * Report a bound property change for a short-valued property.
*
- * @param propertyName the property name.
- * @param oldValue the old property's value.
- * @param newValue the new property's value.
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old property's value.
+ * @param newValue
+ * the new property's value.
*/
public void firePropertyChange(String propertyName, short oldValue, short newValue) {
firePropertyChangeImpl(propertyName, new Short(oldValue), new Short(newValue));
}
/**
- * Report a bound property change for a long-valued property.
+ * Report a bound property change for a long-valued property.
*
- * @param propertyName the property name.
- * @param oldValue the old property's value.
- * @param newValue the new property's value.
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old property's value.
+ * @param newValue
+ * the new property's value.
*/
public void firePropertyChange(String propertyName, long oldValue, long newValue) {
firePropertyChangeImpl(propertyName, new Long(oldValue), new Long(newValue));
}
/**
- * Report a bound property change for a float-valued property.
+ * Report a bound property change for a float-valued property.
*
- * @param propertyName the property name.
- * @param oldValue the old property's value.
- * @param newValue the new property's value.
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old property's value.
+ * @param newValue
+ * the new property's value.
*/
public void firePropertyChange(String propertyName, float oldValue, float newValue) {
firePropertyChangeImpl(propertyName, new Float(oldValue), new Float(newValue));
}
/**
- * Report a bound property change for a double-valued property.
+ * Report a bound property change for a double-valued property.
*
- * @param propertyName the property name.
- * @param oldValue the old property's value.
- * @param newValue the new property's value.
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old property's value.
+ * @param newValue
+ * the new property's value.
*/
public void firePropertyChange(String propertyName, double oldValue, double newValue) {
firePropertyChangeImpl(propertyName, new Double(oldValue), new Double(newValue));
}
/**
- * Gets the alignment along the x axis.
+ * Gets the alignment along the x axis.
*
- * @return the alignment along the x axis.
+ * @return the alignment along the x axis.
*/
public float getAlignmentX() {
toolkit.lockAWT();
@@ -2481,7 +2313,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets the alignment along the y axis.
+ * Gets the alignment along the y axis.
*
* @return the alignment along y axis.
*/
@@ -2502,12 +2334,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
public Color getBackground() {
toolkit.lockAWT();
try {
- //???AWT
+ // ???AWT
/*
- if ((backColor == null) && (parent != null)) {
- return parent.getBackground();
- }
- */
+ * if ((backColor == null) && (parent != null)) { return
+ * parent.getBackground(); }
+ */
return backColor;
} finally {
toolkit.unlockAWT();
@@ -2529,11 +2360,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Writes the data of the bounding rectangle to the specified
- * Rectangle object.
- *
- * @param rv the Rectangle object where the bounding rectangle's data is stored.
+ * Writes the data of the bounding rectangle to the specified Rectangle
+ * object.
*
+ * @param rv
+ * the Rectangle object where the bounding rectangle's data is
+ * stored.
* @return the bounding rectangle.
*/
public Rectangle getBounds(Rectangle rv) {
@@ -2566,8 +2398,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the Component which contains the specified Point.
*
- * @param p the Point.
- *
+ * @param p
+ * the Point.
* @return the Component which contains the specified Point.
*/
public Component getComponentAt(Point p) {
@@ -2580,14 +2412,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets the Component which contains the point with the
- * specified coordinates.
- *
- * @param x the x coordinate of the point.
- * @param y the y coordinate of the point.
+ * Gets the Component which contains the point with the specified
+ * coordinates.
*
- * @return the Component which contains the point with the
- * specified coordinates.
+ * @param x
+ * the x coordinate of the point.
+ * @param y
+ * the y coordinate of the point.
+ * @return the Component which contains the point with the specified
+ * coordinates.
*/
public Component getComponentAt(int x, int y) {
toolkit.lockAWT();
@@ -2622,11 +2455,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
try {
if (cursor != null) {
return cursor;
- //???AWT
- /*
- } else if (parent != null) {
- return parent.getCursor();
- */
+ // ???AWT
+ /*
+ * } else if (parent != null) { return parent.getCursor();
+ */
}
return Cursor.getDefaultCursor();
} finally {
@@ -2634,57 +2466,29 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT
+ // ???AWT
/*
- public DropTarget getDropTarget() {
- toolkit.lockAWT();
- try {
- return dropTarget;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public Container getFocusCycleRootAncestor() {
- toolkit.lockAWT();
- try {
- for (Container c = parent; c != null; c = c.getParent()) {
- if (c.isFocusCycleRoot()) {
- return c;
- }
- }
- return null;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @SuppressWarnings("unchecked")
- public Set getFocusTraversalKeys(int id) {
- toolkit.lockAWT();
- try {
- Integer kId = new Integer(id);
- KeyboardFocusManager.checkTraversalKeysID(traversalKeys, kId);
- Set extends AWTKeyStroke> keys = traversalKeys.get(kId);
- if (keys == null && parent != null) {
- keys = parent.getFocusTraversalKeys(id);
- }
- if (keys == null) {
- keys = KeyboardFocusManager.getCurrentKeyboardFocusManager()
- .getDefaultFocusTraversalKeys(id);
- }
- return (Set) keys;
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
-
+ * public DropTarget getDropTarget() { toolkit.lockAWT(); try { return
+ * dropTarget; } finally { toolkit.unlockAWT(); } } public Container
+ * getFocusCycleRootAncestor() { toolkit.lockAWT(); try { for (Container c =
+ * parent; c != null; c = c.getParent()) { if (c.isFocusCycleRoot()) {
+ * return c; } } return null; } finally { toolkit.unlockAWT(); } }
+ * @SuppressWarnings("unchecked") public Set
+ * getFocusTraversalKeys(int id) { toolkit.lockAWT(); try { Integer kId =
+ * new Integer(id); KeyboardFocusManager.checkTraversalKeysID(traversalKeys,
+ * kId); Set extends AWTKeyStroke> keys = traversalKeys.get(kId); if (keys
+ * == null && parent != null) { keys = parent.getFocusTraversalKeys(id); }
+ * if (keys == null) { keys =
+ * KeyboardFocusManager.getCurrentKeyboardFocusManager()
+ * .getDefaultFocusTraversalKeys(id); } return (Set) keys; }
+ * finally { toolkit.unlockAWT(); } }
+ */
+
/**
* Checks if the the focus traversal keys are enabled for this component.
*
- * @return true, if the the focus traversal keys are enabled for
- * this component, false otherwise.
+ * @return true, if the the focus traversal keys are enabled for this
+ * component, false otherwise.
*/
public boolean getFocusTraversalKeysEnabled() {
toolkit.lockAWT();
@@ -2698,8 +2502,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the font metrics of the specified Font.
*
- * @param f the Font.
- *
+ * @param f
+ * the Font.
* @return the FontMetrics of the specified Font.
*/
@SuppressWarnings("deprecation")
@@ -2715,12 +2519,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
public Color getForeground() {
toolkit.lockAWT();
try {
- //???AWT
+ // ???AWT
/*
- if (foreColor == null && parent != null) {
- return parent.getForeground();
- }
- */
+ * if (foreColor == null && parent != null) { return
+ * parent.getForeground(); }
+ */
return foreColor;
} finally {
toolkit.unlockAWT();
@@ -2728,11 +2531,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets the Graphics of the Component or null if this Component
- * is not displayable.
+ * Gets the Graphics of the Component or null if this Component is not
+ * displayable.
*
- * @return the Graphics of the Component or null if this Component
- * is not displayable.
+ * @return the Graphics of the Component or null if this Component is not
+ * displayable.
*/
public Graphics getGraphics() {
toolkit.lockAWT();
@@ -2749,26 +2552,18 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
-
/**
* Gets the GraphicsConfiguration associated with this Component.
*
* @return the GraphicsConfiguration associated with this Component.
*/
public GraphicsConfiguration getGraphicsConfiguration() {
- //???AWT
+ // ???AWT
/*
- toolkit.lockAWT();
- try {
- Window win = getWindowAncestor();
- if (win == null) {
- return null;
- }
- return win.getGraphicsConfiguration();
- } finally {
- toolkit.unlockAWT();
- }
- */
+ * toolkit.lockAWT(); try { Window win = getWindowAncestor(); if (win ==
+ * null) { return null; } return win.getGraphicsConfiguration(); }
+ * finally { toolkit.unlockAWT(); }
+ */
return null;
}
@@ -2787,11 +2582,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Returns true if paint messages received from the operating system
- * should be ignored.
+ * Returns true if paint messages received from the operating system should
+ * be ignored.
*
- * @return true if paint messages received from the operating system
- * should be ignored, false otherwise.
+ * @return true if paint messages received from the operating system should
+ * be ignored, false otherwise.
*/
public boolean getIgnoreRepaint() {
toolkit.lockAWT();
@@ -2803,23 +2598,20 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets the input context of this component for handling
- * the communication with input methods when text is entered
- * in this component.
+ * Gets the input context of this component for handling the communication
+ * with input methods when text is entered in this component.
*
- * @return the InputContext used by this Component or
- * null if no context is specifined.
+ * @return the InputContext used by this Component or null if no context is
+ * specifined.
*/
public InputContext getInputContext() {
toolkit.lockAWT();
try {
- //???AWT
+ // ???AWT
/*
- Container parent = getParent();
- if (parent != null) {
- return parent.getInputContext();
- }
- */
+ * Container parent = getParent(); if (parent != null) { return
+ * parent.getInputContext(); }
+ */
return null;
} finally {
toolkit.unlockAWT();
@@ -2827,11 +2619,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets the input method request handler which supports requests
- * from input methods for this component, or null for default.
+ * Gets the input method request handler which supports requests from input
+ * methods for this component, or null for default.
*
- * @return the input method request handler which supports requests
- * from input methods for this component, or null for default.
+ * @return the input method request handler which supports requests from
+ * input methods for this component, or null for default.
*/
public InputMethodRequests getInputMethodRequests() {
return null;
@@ -2845,19 +2637,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
public Locale getLocale() {
toolkit.lockAWT();
try {
- //???AWT
+ // ???AWT
/*
- if (locale == null) {
- if (parent == null) {
- if (this instanceof Window) {
- return Locale.getDefault();
- }
- // awt.150=no parent
- throw new IllegalComponentStateException(Messages.getString("awt.150")); //$NON-NLS-1$
- }
- return getParent().getLocale();
- }
- */
+ * if (locale == null) { if (parent == null) { if (this instanceof
+ * Window) { return Locale.getDefault(); } // awt.150=no parent
+ * throw new
+ * IllegalComponentStateException(Messages.getString("awt.150"));
+ * //$NON-NLS-1$ } return getParent().getLocale(); }
+ */
return locale;
} finally {
toolkit.unlockAWT();
@@ -2865,35 +2652,30 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets the location of this component in the form of a point
- * specifying the component's top-left corner in the
- * screen's coordinate space.
+ * Gets the location of this component in the form of a point specifying the
+ * component's top-left corner in the screen's coordinate space.
*
- * @return the Point giving the component's location in the
- * screen's coordinate space.
- *
- * @throws IllegalComponentStateException if the component is
- * not shown on the screen.
+ * @return the Point giving the component's location in the screen's
+ * coordinate space.
+ * @throws IllegalComponentStateException
+ * if the component is not shown on the screen.
*/
public Point getLocationOnScreen() throws IllegalComponentStateException {
toolkit.lockAWT();
try {
Point p = new Point();
if (isShowing()) {
- //???AWT
+ // ???AWT
/*
- Component comp;
- for (comp = this; comp != null && !(comp instanceof Window); comp = comp
- .getParent()) {
- p.translate(comp.getX(), comp.getY());
- }
- if (comp instanceof Window) {
- p.translate(comp.getX(), comp.getY());
- }
- */
+ * Component comp; for (comp = this; comp != null && !(comp
+ * instanceof Window); comp = comp .getParent()) {
+ * p.translate(comp.getX(), comp.getY()); } if (comp instanceof
+ * Window) { p.translate(comp.getX(), comp.getY()); }
+ */
return p;
}
- // awt.151=component must be showing on the screen to determine its location
+ // awt.151=component must be showing on the screen to determine its
+ // location
throw new IllegalComponentStateException(Messages.getString("awt.151")); //$NON-NLS-1$
} finally {
toolkit.unlockAWT();
@@ -2901,11 +2683,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets the peer. This method should not be called directly by
- * user applications.
+ * Gets the peer. This method should not be called directly by user
+ * applications.
*
* @return the ComponentPeer.
- *
* @deprecated Replaced by isDisplayable().
*/
@Deprecated
@@ -2922,24 +2703,24 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets an array of the property change listeners registered to
- * this Component.
+ * Gets an array of the property change listeners registered to this
+ * Component.
*
- * @return an array of the PropertyChangeListeners registered to
- * this Component.
+ * @return an array of the PropertyChangeListeners registered to this
+ * Component.
*/
public PropertyChangeListener[] getPropertyChangeListeners() {
return getPropertyChangeSupport().getPropertyChangeListeners();
}
/**
- * Gets an array of PropertyChangeListener objects registered
- * to this Component for the specified property.
+ * Gets an array of PropertyChangeListener objects registered to this
+ * Component for the specified property.
*
- * @param propertyName the property name.
- *
- * @return an array of PropertyChangeListener objects registered
- * to this Component for the specified property.
+ * @param propertyName
+ * the property name.
+ * @return an array of PropertyChangeListener objects registered to this
+ * Component for the specified property.
*/
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
return getPropertyChangeSupport().getPropertyChangeListeners(propertyName);
@@ -2990,11 +2771,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Got the focus.
*
- * @param evt the Event.
- * @param what the Object.
- *
+ * @param evt
+ * the Event.
+ * @param what
+ * the Object.
* @return true, if successful.
- *
* @deprecated Replaced by processFocusEvent(FocusEvent) method.
*/
@Deprecated
@@ -3007,10 +2788,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Handles event.
*
- * @param evt the Event.
- *
+ * @param evt
+ * the Event.
* @return true, if successful.
- *
* @deprecated Replaced by processEvent(AWTEvent) method.
*/
@Deprecated
@@ -3052,7 +2832,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
public boolean hasFocus() {
toolkit.lockAWT();
try {
- //???AWT: return isFocusOwner();
+ // ???AWT: return isFocusOwner();
return false;
} finally {
toolkit.unlockAWT();
@@ -3076,24 +2856,24 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
moveFocusOnHide();
behaviour.setVisible(false);
postEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_HIDDEN));
- //???AWT: finishHierarchyChange(this, parent, 0);
+ // ???AWT: finishHierarchyChange(this, parent, 0);
notifyInputMethod(null);
- //???AWT: invalidateRealParent();
+ // ???AWT: invalidateRealParent();
} finally {
toolkit.unlockAWT();
}
}
/**
- * Checks whether or not the point with the specified coordinates
- * belongs to the Commponent.
- *
- * @param x the x coordinate of the Point.
- * @param y the y coordinate of the Point.
- *
- * @return true, if the point with the specified coordinates
- * belongs to the Commponent, false otherwise.
+ * Checks whether or not the point with the specified coordinates belongs to
+ * the Commponent.
*
+ * @param x
+ * the x coordinate of the Point.
+ * @param y
+ * the y coordinate of the Point.
+ * @return true, if the point with the specified coordinates belongs to the
+ * Commponent, false otherwise.
* @deprecated Replaced by contains(int, int) method.
*/
@Deprecated
@@ -3107,15 +2887,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Invalidates the component, this component and all parents
- * above it are marked as needing to be laid out.
+ * Invalidates the component, this component and all parents above it are
+ * marked as needing to be laid out.
*/
public void invalidate() {
toolkit.lockAWT();
try {
valid = false;
resetDefaultSize();
- //???AWT: invalidateRealParent();
+ // ???AWT: invalidateRealParent();
} finally {
toolkit.unlockAWT();
}
@@ -3124,8 +2904,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks whether or not the background color is set to this Component.
*
- * @return true, if the background color is set to this Component,
- * false otherwise.
+ * @return true, if the background color is set to this Component, false
+ * otherwise.
*/
public boolean isBackgroundSet() {
toolkit.lockAWT();
@@ -3139,8 +2919,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks whether or not a cursor is set for the Component.
*
- * @return true, if a cursor is set for the Component,
- * false otherwise.
+ * @return true, if a cursor is set for the Component, false otherwise.
*/
public boolean isCursorSet() {
toolkit.lockAWT();
@@ -3166,11 +2945,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Checks whether or not this component is painted to an buffer
- * which is copied to the screen later.
+ * Checks whether or not this component is painted to an buffer which is
+ * copied to the screen later.
*
- * @return true, if this component is painted to an buffer
- * which is copied to the screen later, false otherwise.
+ * @return true, if this component is painted to an buffer which is copied
+ * to the screen later, false otherwise.
*/
public boolean isDoubleBuffered() {
toolkit.lockAWT();
@@ -3200,7 +2979,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* "Recursive" isEnabled().
*
* @return true if not only component itself is enabled but its heavyweight
- * parent is also "indirectly" enabled
+ * parent is also "indirectly" enabled.
*/
boolean isIndirectlyEnabled() {
Component comp = this;
@@ -3208,7 +2987,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
if (!comp.isLightweight() && !comp.isEnabled()) {
return false;
}
- //???AWT: comp = comp.getRealParent();
+ // ???AWT: comp = comp.getRealParent();
}
return true;
}
@@ -3216,7 +2995,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if the component is key enabled.
*
- * @return true, if the component is enabled and indirectly enabled
+ * @return true, if the component is enabled and indirectly enabled.
*/
boolean isKeyEnabled() {
if (!isEnabled()) {
@@ -3229,39 +3008,24 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Gets only parent of a child component, but not owner of a window.
*
* @return parent of child component, null if component is a top-level
- * (Window instance)
+ * (Window instance).
*/
- //???AWT
+ // ???AWT
/*
- Container getRealParent() {
- return (!(this instanceof Window) ? getParent() : null);
- }
-
- public boolean isFocusCycleRoot(Container container) {
- toolkit.lockAWT();
- try {
- return getFocusCycleRootAncestor() == container;
- } finally {
- toolkit.unlockAWT();
- }
- }
+ * Container getRealParent() { return (!(this instanceof Window) ?
+ * getParent() : null); } public boolean isFocusCycleRoot(Container
+ * container) { toolkit.lockAWT(); try { return getFocusCycleRootAncestor()
+ * == container; } finally { toolkit.unlockAWT(); } } public boolean
+ * isFocusOwner() { toolkit.lockAWT(); try { return
+ * KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() ==
+ * this; } finally { toolkit.unlockAWT(); } }
+ */
- public boolean isFocusOwner() {
- toolkit.lockAWT();
- try {
- return KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == this;
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
-
/**
* Checks whether or not this Component can be focusable.
*
* @return true, if this Component can be focusable, false otherwise.
- *
- * @deprecated Replaced by isFocusable().
+ * @deprecated Replaced by isFocusable().
*/
@Deprecated
public boolean isFocusTraversable() {
@@ -3306,8 +3070,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if foreground color is set for the Component or not.
*
- * @return true, if is foreground color is set for the Component,
- * false otherwise.
+ * @return true, if is foreground color is set for the Component, false
+ * otherwise.
*/
public boolean isForegroundSet() {
toolkit.lockAWT();
@@ -3321,8 +3085,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Returns true if this component has a lightweight peer.
*
- * @return true, if this component has a lightweight peer,
- * false if it has a native peer or no peer.
+ * @return true, if this component has a lightweight peer, false if it has a
+ * native peer or no peer.
*/
public boolean isLightweight() {
toolkit.lockAWT();
@@ -3333,22 +3097,18 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
-
/**
* Checks whether or not this Component is shown.
*
* @return true, if this Component is shown, false otherwise.
*/
public boolean isShowing() {
- //???AWT
+ // ???AWT
/*
- toolkit.lockAWT();
- try {
- return (isVisible() && isDisplayable() && (parent != null) && parent.isShowing());
- } finally {
- toolkit.unlockAWT();
- }
- */
+ * toolkit.lockAWT(); try { return (isVisible() && isDisplayable() &&
+ * (parent != null) && parent.isShowing()); } finally {
+ * toolkit.unlockAWT(); }
+ */
return false;
}
@@ -3369,11 +3129,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by processKeyEvent(KeyEvent) method.
*
- * @param evt the Event.
- * @param key the key code.
- *
+ * @param evt
+ * the Event.
+ * @param key
+ * the key code.
* @return true, if successful.
- *
* @deprecated Replaced by replaced by processKeyEvent(KeyEvent) method.
*/
@Deprecated
@@ -3386,11 +3146,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by processKeyEvent(KeyEvent) method.
*
- * @param evt the Event.
- * @param key the key code.
- *
+ * @param evt
+ * the Event.
+ * @param key
+ * the key code.
* @return true, if successful.
- *
* @deprecated Replaced by processKeyEvent(KeyEvent) method.
*/
@Deprecated
@@ -3418,11 +3178,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by getComponentAt(int, int) method.
*
- * @param x the x coordinate.
- * @param y the y coordinate.
- *
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
* @return The component.
- *
* @deprecated Replaced by getComponentAt(int, int) method.
*/
@Deprecated
@@ -3439,13 +3199,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Deprecated: replaced by processFocusEvent(FocusEvent).
- *
- * @param evt the Event.
- * @param what the Object.
+ * Deprecated: replaced by processFocusEvent(FocusEvent).
*
+ * @param evt
+ * the Event.
+ * @param what
+ * the Object.
* @return true, if successful.
- *
* @deprecated Replaced by processFocusEvent(FocusEvent).
*/
@Deprecated
@@ -3458,12 +3218,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by processMouseEvent(MouseEvent) method.
*
- * @param evt the MouseEvent.
- * @param x the x coordinate.
- * @param y the y coordinate.
- *
+ * @param evt
+ * the MouseEvent.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
* @return true, if successful.
- *
* @deprecated Replaced by processMouseEvent(MouseEvent) method.
*/
@Deprecated
@@ -3476,12 +3237,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by getMinimumSize() method.
*
- * @param evt the Event.
- * @param x the x coordinate.
- * @param y the y coordinate.
- *
+ * @param evt
+ * the Event.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
* @return true, if successful.
- *
* @deprecated Replaced by getMinimumSize() method.
*/
@Deprecated
@@ -3494,12 +3256,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Replaced by processMouseEvent(MouseEvent) method.
*
- * @param evt the Event.
- * @param x the x coordinate.
- * @param y the y coordinate.
- *
+ * @param evt
+ * the Event.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
* @return true, if successful.
- *
* @deprecated replaced by processMouseEvent(MouseEvent) method.
*/
@Deprecated
@@ -3512,12 +3275,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Replaced by processMouseEvent(MouseEvent) method.
*
- * @param evt the Event.
- * @param x the x coordinate.
- * @param y the y coordinate.
- *
+ * @param evt
+ * the Event.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
* @return true, if successful.
- *
* @deprecated Replaced by processMouseEvent(MouseEvent) method.
*/
@Deprecated
@@ -3530,12 +3294,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Replaced by processMouseEvent(MouseEvent) method.
*
- * @param evt the Event.
- * @param x the x coordinate.
- * @param y the y coordinate.
- *
+ * @param evt
+ * the Event.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
* @deprecated Replaced by processMouseEvent(MouseEvent) method.
- *
* @return true, if successful.
*/
@Deprecated
@@ -3548,12 +3313,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Replaced by processMouseEvent(MouseEvent) method.
*
- * @param evt the Event.
- * @param x the x coordinate.
- * @param y the y coordinate.
- *
+ * @param evt
+ * the Event.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
* @return true, if successful.
- *
* @deprecated Replaced by processMouseEvent(MouseEvent) method.
*/
@Deprecated
@@ -3566,9 +3332,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by setLocation(int, int) method.
*
- * @param x the x coordinates.
- * @param y the y coordinates.
- *
+ * @param x
+ * the x coordinates.
+ * @param y
+ * the y coordinates.
* @deprecated Replaced by setLocation(int, int) method.
*/
@Deprecated
@@ -3582,18 +3349,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT
+ // ???AWT
/*
- @Deprecated
- public void nextFocus() {
- toolkit.lockAWT();
- try {
- transferFocus(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
+ * @Deprecated public void nextFocus() { toolkit.lockAWT(); try {
+ * transferFocus(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); } finally {
+ * toolkit.unlockAWT(); } }
+ */
/**
* Returns a string representation of the component's state.
@@ -3603,10 +3364,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
protected String paramString() {
/*
* The format is based on 1.5 release behavior which can be revealed by
- * the following code:
- *
- * Component c = new Component(){}; c.setVisible(false);
- * System.out.println(c);
+ * the following code: Component c = new Component(){};
+ * c.setVisible(false); System.out.println(c);
*/
toolkit.lockAWT();
try {
@@ -3624,35 +3383,27 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
if (handled) {
return true;
}
- //???AWT
+ // ???AWT
/*
-
- // propagate non-handled events up to parent
- Component par = parent;
- // try to call postEvent only on components which
- // override any of deprecated method handlers
- // while (par != null && !par.deprecatedEventHandler) {
- // par = par.parent;
- // }
- // translate event coordinates before posting it to parent
- if (par != null) {
- evt.translate(x, y);
- par.postEvent(evt);
- }
-
- */
+ * // propagate non-handled events up to parent Component par = parent;
+ * // try to call postEvent only on components which // override any of
+ * deprecated method handlers // while (par != null &&
+ * !par.deprecatedEventHandler) { // par = par.parent; // } // translate
+ * event coordinates before posting it to parent if (par != null) {
+ * evt.translate(x, y); par.postEvent(evt); }
+ */
return false;
}
/**
- * Prepares an image for rendering on the Component.
- *
- * @param image the Image to be prepared.
- * @param observer the ImageObserver object to be notified as soon as
- * the image is prepared.
+ * Prepares an image for rendering on the Component.
*
- * @return true if the image has been fully prepared,
- * false otherwise.
+ * @param image
+ * the Image to be prepared.
+ * @param observer
+ * the ImageObserver object to be notified as soon as the image
+ * is prepared.
+ * @return true if the image has been fully prepared, false otherwise.
*/
public boolean prepareImage(Image image, ImageObserver observer) {
toolkit.lockAWT();
@@ -3664,17 +3415,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Prepares an image for rendering on the Component with the
- * specified width, height, and ImageObserver.
+ * Prepares an image for rendering on the Component with the specified
+ * width, height, and ImageObserver.
*
- * @param image the Image to be prepared.
- * @param width the width of scaled image.
- * @param height the height of scaled height.
- * @param observer the ImageObserver object to be notified as soon as
- * the image is prepared.
- *
- * @return true if the image is been fully prepared,
- * false otherwise.
+ * @param image
+ * the Image to be prepared.
+ * @param width
+ * the width of scaled image.
+ * @param height
+ * the height of scaled height.
+ * @param observer
+ * the ImageObserver object to be notified as soon as the image
+ * is prepared.
+ * @return true if the image is been fully prepared, false otherwise.
*/
public boolean prepareImage(Image image, int width, int height, ImageObserver observer) {
toolkit.lockAWT();
@@ -3691,16 +3444,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
public void removeNotify() {
toolkit.lockAWT();
try {
- //???AWT
+ // ???AWT
/*
- if (dropTarget != null) {
- dropTarget.removeNotify(peer);
- }
- */
+ * if (dropTarget != null) { dropTarget.removeNotify(peer); }
+ */
prepare4HierarchyChange();
- ///???AWT: moveFocus();
+ // /???AWT: moveFocus();
behaviour.removeNotify();
- //???AWT: finishHierarchyChange(this, parent, 0);
+ // ???AWT: finishHierarchyChange(this, parent, 0);
removeNotifyInputContext();
} finally {
toolkit.unlockAWT();
@@ -3708,7 +3459,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Calls InputContext.removeNotify
+ * Calls InputContext.removeNotify.
*/
private void removeNotifyInputContext() {
if (!inputMethodsEnabled) {
@@ -3716,7 +3467,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
InputContext ic = getInputContext();
if (ic != null) {
- //???AWT: ic.removeNotify(this);
+ // ???AWT: ic.removeNotify(this);
}
}
@@ -3726,46 +3477,25 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* setFocusable(false) is called, and therefore automatic forward focus
* traversal is necessary
*/
- //???AWT
+ // ???AWT
/*
- void moveFocus() {
- // don't use transferFocus(), but query focus traversal policy directly
- // and if it returns null, transfer focus up cycle
- // and find next focusable component there
- KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
- Container root = kfm.getCurrentFocusCycleRoot();
- Component nextComp = this;
- boolean success = !isFocusOwner();
- while (!success) {
- if (root != nextComp.getFocusCycleRootAncestor()) {
- // component was probably removed from container
- // so focus will be lost in some time
- return;
- }
- nextComp = root.getFocusTraversalPolicy().getComponentAfter(root, nextComp);
- if (nextComp == this) {
- nextComp = null; // avoid looping
- }
- if (nextComp != null) {
- success = nextComp.requestFocusInWindow();
- } else {
- nextComp = root;
- root = root.getFocusCycleRootAncestor();
- // if no acceptable component is found at all - clear global
- // focus owner
- if (root == null) {
- if (nextComp instanceof Window) {
- Window wnd = (Window) nextComp;
- wnd.setFocusOwner(null);
- wnd.setRequestedFocus(null);
- }
- kfm.clearGlobalFocusOwner();
- return;
- }
- }
- }
- }
- */
+ * void moveFocus() { // don't use transferFocus(), but query focus
+ * traversal policy directly // and if it returns null, transfer focus up
+ * cycle // and find next focusable component there KeyboardFocusManager kfm
+ * = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Container root =
+ * kfm.getCurrentFocusCycleRoot(); Component nextComp = this; boolean
+ * success = !isFocusOwner(); while (!success) { if (root !=
+ * nextComp.getFocusCycleRootAncestor()) { // component was probably removed
+ * from container // so focus will be lost in some time return; } nextComp =
+ * root.getFocusTraversalPolicy().getComponentAfter(root, nextComp); if
+ * (nextComp == this) { nextComp = null; // avoid looping } if (nextComp !=
+ * null) { success = nextComp.requestFocusInWindow(); } else { nextComp =
+ * root; root = root.getFocusCycleRootAncestor(); // if no acceptable
+ * component is found at all - clear global // focus owner if (root == null)
+ * { if (nextComp instanceof Window) { Window wnd = (Window) nextComp;
+ * wnd.setFocusOwner(null); wnd.setRequestedFocus(null); }
+ * kfm.clearGlobalFocusOwner(); return; } } } }
+ */
/**
* For Container there's a difference between moving focus when being made
@@ -3774,80 +3504,73 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* setVisible() is not called.
*/
void moveFocusOnHide() {
- //???AWT: moveFocus();
+ // ???AWT: moveFocus();
}
/**
* Removes the property change listener registered for this component.
*
- * @param listener the PropertyChangeListener.
+ * @param listener
+ * the PropertyChangeListener.
*/
public void removePropertyChangeListener(PropertyChangeListener listener) {
getPropertyChangeSupport().removePropertyChangeListener(listener);
}
/**
- * Removes the property change listener registered fot this component
- * for the specified propertyy.
+ * Removes the property change listener registered fot this component for
+ * the specified propertyy.
*
- * @param propertyName the property name.
- * @param listener the PropertyChangeListener.
+ * @param propertyName
+ * the property name.
+ * @param listener
+ * the PropertyChangeListener.
*/
- public void removePropertyChangeListener(String propertyName,
- PropertyChangeListener listener) {
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
getPropertyChangeSupport().removePropertyChangeListener(propertyName, listener);
}
-
/**
- * Repaints the specified rectangle of this component within
- * tm milliseconds.
+ * Repaints the specified rectangle of this component within tm
+ * milliseconds.
*
- * @param tm the time in milliseconds before updating.
- * @param x the x coordinate of Rectangle.
- * @param y the y coordinate of Rectangle.
- * @param width the width of Rectangle.
- * @param height the height of Rectangle.
+ * @param tm
+ * the time in milliseconds before updating.
+ * @param x
+ * the x coordinate of Rectangle.
+ * @param y
+ * the y coordinate of Rectangle.
+ * @param width
+ * the width of Rectangle.
+ * @param height
+ * the height of Rectangle.
*/
public void repaint(long tm, int x, int y, int width, int height) {
- //???AWT
+ // ???AWT
/*
- toolkit.lockAWT();
- try {
- if (width <= 0 || height <= 0 || (redrawManager == null) || !isShowing()) {
- return;
- }
- if (behaviour instanceof LWBehavior) {
- if (parent == null || !parent.visible || !parent.behaviour.isDisplayable()) {
- return;
- }
- if (repaintRegion == null) {
- repaintRegion = new MultiRectArea(new Rectangle(x, y, width, height));
- }
- repaintRegion.intersect(new Rectangle(0, 0, this.w, this.h));
- repaintRegion.translate(this.x, this.y);
- parent.repaintRegion = repaintRegion;
- repaintRegion = null;
- parent.repaint(tm, x + this.x, y + this.y, width, height);
- } else {
- if (repaintRegion != null) {
- redrawManager.addUpdateRegion(this, repaintRegion);
- repaintRegion = null;
- } else {
- redrawManager.addUpdateRegion(this, new Rectangle(x, y, width, height));
- }
- toolkit.getSystemEventQueueCore().notifyEventMonitor(toolkit);
- }
- } finally {
- toolkit.unlockAWT();
- }
- */
+ * toolkit.lockAWT(); try { if (width <= 0 || height <= 0 ||
+ * (redrawManager == null) || !isShowing()) { return; } if (behaviour
+ * instanceof LWBehavior) { if (parent == null || !parent.visible ||
+ * !parent.behaviour.isDisplayable()) { return; } if (repaintRegion ==
+ * null) { repaintRegion = new MultiRectArea(new Rectangle(x, y, width,
+ * height)); } repaintRegion.intersect(new Rectangle(0, 0, this.w,
+ * this.h)); repaintRegion.translate(this.x, this.y);
+ * parent.repaintRegion = repaintRegion; repaintRegion = null;
+ * parent.repaint(tm, x + this.x, y + this.y, width, height); } else {
+ * if (repaintRegion != null) { redrawManager.addUpdateRegion(this,
+ * repaintRegion); repaintRegion = null; } else {
+ * redrawManager.addUpdateRegion(this, new Rectangle(x, y, width,
+ * height)); }
+ * toolkit.getSystemEventQueueCore().notifyEventMonitor(toolkit); } }
+ * finally { toolkit.unlockAWT(); }
+ */
}
/**
* Post event.
*
- * @param e the e
+ * @param e
+ * the e.
*/
void postEvent(AWTEvent e) {
getToolkit().getSystemEventQueueImpl().postEvent(e);
@@ -3856,10 +3579,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Repaints the specified Rectangle of this Component.
*
- * @param x the x coordinate of Rectangle.
- * @param y the y coordinate of Rectangle.
- * @param width the width of Rectangle.
- * @param height the height of Rectangle.
+ * @param x
+ * the x coordinate of Rectangle.
+ * @param y
+ * the y coordinate of Rectangle.
+ * @param width
+ * the width of Rectangle.
+ * @param height
+ * the height of Rectangle.
*/
public void repaint(int x, int y, int width, int height) {
toolkit.lockAWT();
@@ -3887,7 +3614,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Repaints the component within tm milliseconds.
*
- * @param tm the time in milliseconds before updating.
+ * @param tm
+ * the time in milliseconds before updating.
*/
public void repaint(long tm) {
toolkit.lockAWT();
@@ -3899,29 +3627,28 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Requests that this Component get the input focus temporarily.
- * This component must be displayable, visible, and focusable.
+ * Requests that this Component get the input focus temporarily. This
+ * component must be displayable, visible, and focusable.
*
- * @param temporary this parameter is true if the focus change
- * is temporary, when the window loses the focus.
- *
- * @return true if the focus change request is succeeded,
- * false otherwise.
+ * @param temporary
+ * this parameter is true if the focus change is temporary, when
+ * the window loses the focus.
+ * @return true if the focus change request is succeeded, false otherwise.
*/
protected boolean requestFocus(boolean temporary) {
toolkit.lockAWT();
try {
- //???AWT: return requestFocusImpl(temporary, true, false);
+ // ???AWT: return requestFocusImpl(temporary, true, false);
} finally {
toolkit.unlockAWT();
}
- //???AWT
+ // ???AWT
return false;
}
/**
- * Requests that this Component get the input focus.
- * This component must be displayable, visible, and focusable.
+ * Requests that this Component get the input focus. This component must be
+ * displayable, visible, and focusable.
*/
public void requestFocus() {
toolkit.lockAWT();
@@ -3932,55 +3659,35 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT
+ // ???AWT
/*
- protected boolean requestFocusInWindow(boolean temporary) {
- toolkit.lockAWT();
- try {
- Window wnd = getWindowAncestor();
- if ((wnd == null) || !wnd.isFocused()) {
- return false;
- }
- return requestFocusImpl(temporary, false, false);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- boolean requestFocusImpl(boolean temporary, boolean crossWindow, boolean rejectionRecovery) {
- if (!rejectionRecovery && isFocusOwner()) {
- return true;
- }
- Window wnd = getWindowAncestor();
- Container par = getRealParent();
- if ((par != null) && par.isRemoved) {
- return false;
- }
- if (!isShowing() || !isFocusable() || !wnd.isFocusableWindow()) {
- return false;
- }
- return KeyboardFocusManager.getCurrentKeyboardFocusManager().requestFocus(this,
- temporary, crossWindow, true);
- }
-
- public boolean requestFocusInWindow() {
- toolkit.lockAWT();
- try {
- return requestFocusInWindow(false);
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
+ * protected boolean requestFocusInWindow(boolean temporary) {
+ * toolkit.lockAWT(); try { Window wnd = getWindowAncestor(); if ((wnd ==
+ * null) || !wnd.isFocused()) { return false; } return
+ * requestFocusImpl(temporary, false, false); } finally {
+ * toolkit.unlockAWT(); } } boolean requestFocusImpl(boolean temporary,
+ * boolean crossWindow, boolean rejectionRecovery) { if (!rejectionRecovery
+ * && isFocusOwner()) { return true; } Window wnd = getWindowAncestor();
+ * Container par = getRealParent(); if ((par != null) && par.isRemoved) {
+ * return false; } if (!isShowing() || !isFocusable() ||
+ * !wnd.isFocusableWindow()) { return false; } return
+ * KeyboardFocusManager.getCurrentKeyboardFocusManager().requestFocus(this,
+ * temporary, crossWindow, true); } public boolean requestFocusInWindow() {
+ * toolkit.lockAWT(); try { return requestFocusInWindow(false); } finally {
+ * toolkit.unlockAWT(); } }
+ */
/**
* Deprecated: replaced by setBounds(int, int, int, int) method.
*
- * @param x the x coordinate.
- * @param y the y coordinate.
- * @param w the width.
- * @param h the height.
- *
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
+ * @param w
+ * the width.
+ * @param h
+ * the height.
* @deprecated Replaced by setBounds(int, int, int, int) method.
*/
@Deprecated
@@ -3995,13 +3702,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Sets rectangle for this Component to be the rectangle with the specified
+ * Sets rectangle for this Component to be the rectangle with the specified
* x,y coordinates of the top-left corner and the width and height.
*
- * @param x the x coordinate of the rectangle's top-left corner.
- * @param y the y coordinate of the rectangle's top-left corner.
- * @param w the width of rectangle.
- * @param h the height of rectangle.
+ * @param x
+ * the x coordinate of the rectangle's top-left corner.
+ * @param y
+ * the y coordinate of the rectangle's top-left corner.
+ * @param w
+ * the width of rectangle.
+ * @param h
+ * the height of rectangle.
*/
public void setBounds(int x, int y, int w, int h) {
toolkit.lockAWT();
@@ -4013,16 +3724,22 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Sets rectangle for this Component to be the rectangle with the specified
- * x,y coordinates of the top-left corner and the width and height
- * and posts the appropriate events.
+ * Sets rectangle for this Component to be the rectangle with the specified
+ * x,y coordinates of the top-left corner and the width and height and posts
+ * the appropriate events.
*
- * @param x the x coordinate of the rectangle's top-left corner.
- * @param y the y coordinate of the rectangle's top-left corner.
- * @param w the width of rectangle.
- * @param h the height of rectangle.
- * @param bMask the bitmask of bounds options
- * @param updateBehavior the whether to update the behavoir's bounds as well
+ * @param x
+ * the x coordinate of the rectangle's top-left corner.
+ * @param y
+ * the y coordinate of the rectangle's top-left corner.
+ * @param w
+ * the width of rectangle.
+ * @param h
+ * the height of rectangle.
+ * @param bMask
+ * the bitmask of bounds options.
+ * @param updateBehavior
+ * the whether to update the behavoir's bounds as well.
*/
void setBounds(int x, int y, int w, int h, int bMask, boolean updateBehavior) {
int oldX = this.x;
@@ -4032,7 +3749,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
setBoundsFields(x, y, w, h, bMask);
// Moved
if ((oldX != this.x) || (oldY != this.y)) {
- //???AWT: invalidateRealParent();
+ // ???AWT: invalidateRealParent();
postEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED));
spreadHierarchyBoundsEvents(this, HierarchyEvent.ANCESTOR_MOVED);
}
@@ -4051,7 +3768,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Calls InputContextImpl.notifyClientWindowChanged.
*
- * @param bounds the bounds
+ * @param bounds
+ * the bounds.
*/
void notifyInputMethod(Rectangle bounds) {
// only Window actually notifies IM of bounds change
@@ -4060,11 +3778,16 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the bounds fields.
*
- * @param x the x
- * @param y the y
- * @param w the w
- * @param h the h
- * @param bMask the b mask
+ * @param x
+ * the x.
+ * @param y
+ * the y.
+ * @param w
+ * the w.
+ * @param h
+ * the h.
+ * @param bMask
+ * the b mask.
*/
private void setBoundsFields(int x, int y, int w, int h, int bMask) {
if ((bMask & NativeWindow.BOUNDS_NOSIZE) == 0) {
@@ -4080,7 +3803,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the native insets.
*
- * @return the native insets
+ * @return the native insets.
*/
Insets getNativeInsets() {
return new Insets(0, 0, 0, 0);
@@ -4089,7 +3812,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the insets.
*
- * @return the insets
+ * @return the insets.
*/
Insets getInsets() {
return new Insets(0, 0, 0, 0);
@@ -4098,7 +3821,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if is mouse exited expected.
*
- * @return true, if is mouse exited expected
+ * @return true, if is mouse exited expected.
*/
boolean isMouseExitedExpected() {
return mouseExitedExpected;
@@ -4107,7 +3830,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the mouse exited expected.
*
- * @param expected the new mouse exited expected
+ * @param expected
+ * the new mouse exited expected.
*/
void setMouseExitedExpected(boolean expected) {
mouseExitedExpected = expected;
@@ -4116,7 +3840,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the new bounding rectangle for this Component.
*
- * @param r the new bounding rectangle.
+ * @param r
+ * the new bounding rectangle.
*/
public void setBounds(Rectangle r) {
toolkit.lockAWT();
@@ -4128,10 +3853,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Sets the component orientation which affects the component's
- * elements and text within this component.
+ * Sets the component orientation which affects the component's elements and
+ * text within this component.
*
- * @param o the ComponentOrientation object.
+ * @param o
+ * the ComponentOrientation object.
*/
public void setComponentOrientation(ComponentOrientation o) {
ComponentOrientation oldOrientation;
@@ -4149,7 +3875,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the specified cursor for this Component.
*
- * @param cursor the new Cursor.
+ * @param cursor
+ * the new Cursor.
*/
public void setCursor(Cursor cursor) {
toolkit.lockAWT();
@@ -4168,26 +3895,20 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
if (isDisplayable() && isShowing()) {
Rectangle absRect = new Rectangle(getLocationOnScreen(), getSize());
Point absPointerPos = toolkit.dispatcher.mouseDispatcher.getPointerPos();
- //???AWT
+ // ???AWT
/*
- if (absRect.contains(absPointerPos)) {
- // set Cursor only on top-level Windows(on X11)
- Window topLevelWnd = getWindowAncestor();
- if (topLevelWnd != null) {
- Point pointerPos = MouseDispatcher.convertPoint(null, absPointerPos,
- topLevelWnd);
- Component compUnderCursor = topLevelWnd.findComponentAt(pointerPos);
- // if (compUnderCursor == this ||
- // compUnderCursor.getCursorAncestor() == this) {
- NativeWindow wnd = topLevelWnd.getNativeWindow();
- if (compUnderCursor != null && wnd != null) {
- compUnderCursor.getRealCursor().getNativeCursor()
- .setCursor(wnd.getId());
- }
- // }
- }
- }
- */
+ * if (absRect.contains(absPointerPos)) { // set Cursor only on
+ * top-level Windows(on X11) Window topLevelWnd =
+ * getWindowAncestor(); if (topLevelWnd != null) { Point pointerPos
+ * = MouseDispatcher.convertPoint(null, absPointerPos, topLevelWnd);
+ * Component compUnderCursor =
+ * topLevelWnd.findComponentAt(pointerPos); // if (compUnderCursor
+ * == this || // compUnderCursor.getCursorAncestor() == this) {
+ * NativeWindow wnd = topLevelWnd.getNativeWindow(); if
+ * (compUnderCursor != null && wnd != null) {
+ * compUnderCursor.getRealCursor().getNativeCursor()
+ * .setCursor(wnd.getId()); } // } } }
+ */
}
}
@@ -4195,68 +3916,44 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Gets the ancestor Cursor if Component is disabled (directly or via an
* ancestor) even if Cursor is explicitly set.
*
- * @param value the value
- *
- * @return actual Cursor to be displayed
+ * @param value
+ * the value.
+ * @return the actual Cursor to be displayed.
*/
- //???AWT
+ // ???AWT
/*
- Cursor getRealCursor() {
- Component cursorAncestor = getCursorAncestor();
- return cursorAncestor != null ? cursorAncestor.getCursor() : Cursor.getDefaultCursor();
- }
- */
+ * Cursor getRealCursor() { Component cursorAncestor = getCursorAncestor();
+ * return cursorAncestor != null ? cursorAncestor.getCursor() :
+ * Cursor.getDefaultCursor(); }
+ */
/**
* Gets the ancestor(or component itself) whose cursor is set when pointer
* is inside component
*
- * @return actual Cursor to be displayed
+ * @return the actual Cursor to be displayed.
*/
- //???AWT
+ // ???AWT
/*
- Component getCursorAncestor() {
- Component comp;
- for (comp = this; comp != null; comp = comp.getParent()) {
- if (comp instanceof Window || comp.isCursorSet() && comp.isKeyEnabled()) {
- return comp;
- }
- }
- return null;
- }
+ * Component getCursorAncestor() { Component comp; for (comp = this; comp !=
+ * null; comp = comp.getParent()) { if (comp instanceof Window ||
+ * comp.isCursorSet() && comp.isKeyEnabled()) { return comp; } } return
+ * null; } public void setDropTarget(DropTarget dt) { toolkit.lockAWT(); try
+ * { if (dropTarget == dt) { return; } DropTarget oldDropTarget =
+ * dropTarget; dropTarget = dt; if (oldDropTarget != null) { if
+ * (behaviour.isDisplayable()) { oldDropTarget.removeNotify(peer); }
+ * oldDropTarget.setComponent(null); } if (dt != null) {
+ * dt.setComponent(this); if (behaviour.isDisplayable()) {
+ * dt.addNotify(peer); } } } finally { toolkit.unlockAWT(); } }
+ */
- public void setDropTarget(DropTarget dt) {
- toolkit.lockAWT();
- try {
- if (dropTarget == dt) {
- return;
- }
- DropTarget oldDropTarget = dropTarget;
- dropTarget = dt;
- if (oldDropTarget != null) {
- if (behaviour.isDisplayable()) {
- oldDropTarget.removeNotify(peer);
- }
- oldDropTarget.setComponent(null);
- }
- if (dt != null) {
- dt.setComponent(this);
- if (behaviour.isDisplayable()) {
- dt.addNotify(peer);
- }
- }
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
-
/**
- * Sets this component to the "enabled" or "disabled" state depending
- * on the specified boolean parameter.
+ * Sets this component to the "enabled" or "disabled" state depending on the
+ * specified boolean parameter.
*
- * @param value true if this component should be enabled; false
- * if this component should be disabled.
+ * @param value
+ * true if this component should be enabled; false if this
+ * component should be disabled.
*/
public void setEnabled(boolean value) {
toolkit.lockAWT();
@@ -4270,7 +3967,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the enabled impl.
*
- * @param value the new enabled impl
+ * @param value
+ * the new enabled impl.
*/
void setEnabledImpl(boolean value) {
if (enabled != value) {
@@ -4283,77 +3981,49 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT
+ // ???AWT
/*
- private void fireAccessibleStateChange(AccessibleState state, boolean value) {
- if (behaviour.isLightweight()) {
- return;
- }
- AccessibleContext ac = getAccessibleContext();
- if (ac != null) {
- AccessibleState oldValue = null;
- AccessibleState newValue = null;
- if (value) {
- newValue = state;
- } else {
- oldValue = state;
- }
- ac.firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, oldValue,
- newValue);
- }
- }
- */
+ * private void fireAccessibleStateChange(AccessibleState state, boolean
+ * value) { if (behaviour.isLightweight()) { return; } AccessibleContext ac
+ * = getAccessibleContext(); if (ac != null) { AccessibleState oldValue =
+ * null; AccessibleState newValue = null; if (value) { newValue = state; }
+ * else { oldValue = state; }
+ * ac.firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ * oldValue, newValue); } }
+ */
- //???AWT
+ // ???AWT
/*
- public void setFocusTraversalKeys(int id, Set extends AWTKeyStroke> keystrokes) {
- Set extends AWTKeyStroke> oldTraversalKeys;
- String propName = "FocusTraversalKeys"; //$NON-NLS-1$
- toolkit.lockAWT();
- try {
- Integer kId = new Integer(id);
- KeyboardFocusManager.checkTraversalKeysID(traversalKeys, kId);
- Map> keys = new HashMap>();
- for (int kid : traversalIDs) {
- Integer key = new Integer(kid);
- keys.put(key, getFocusTraversalKeys(kid));
- }
- KeyboardFocusManager.checkKeyStrokes(traversalIDs, keys, kId, keystrokes);
- oldTraversalKeys = traversalKeys.get(new Integer(id));
- // put a copy of keystrokes object into map:
- Set extends AWTKeyStroke> newKeys = keystrokes;
- if (keystrokes != null) {
- newKeys = new HashSet(keystrokes);
- }
- traversalKeys.put(kId, newKeys);
- String direction = ""; //$NON-NLS-1$
- switch (id) {
- case KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS:
- direction = "forward"; //$NON-NLS-1$
- break;
- case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS:
- direction = "backward"; //$NON-NLS-1$
- break;
- case KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS:
- direction = "upCycle"; //$NON-NLS-1$
- break;
- case KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS:
- direction = "downCycle"; //$NON-NLS-1$
- break;
- }
- propName = direction + propName;
- } finally {
- toolkit.unlockAWT();
- }
- firePropertyChange(propName, oldTraversalKeys, keystrokes);
- }
- */
+ * public void setFocusTraversalKeys(int id, Set extends AWTKeyStroke>
+ * keystrokes) { Set extends AWTKeyStroke> oldTraversalKeys; String
+ * propName = "FocusTraversalKeys"; //$NON-NLS-1$ toolkit.lockAWT(); try {
+ * Integer kId = new Integer(id);
+ * KeyboardFocusManager.checkTraversalKeysID(traversalKeys, kId);
+ * Map> keys = new HashMap>(); for (int kid : traversalIDs) { Integer
+ * key = new Integer(kid); keys.put(key, getFocusTraversalKeys(kid)); }
+ * KeyboardFocusManager.checkKeyStrokes(traversalIDs, keys, kId,
+ * keystrokes); oldTraversalKeys = traversalKeys.get(new Integer(id)); //
+ * put a copy of keystrokes object into map: Set extends AWTKeyStroke>
+ * newKeys = keystrokes; if (keystrokes != null) { newKeys = new
+ * HashSet(keystrokes); } traversalKeys.put(kId, newKeys);
+ * String direction = ""; //$NON-NLS-1$ switch (id) { case
+ * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS: direction = "forward";
+ * //$NON-NLS-1$ break; case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS:
+ * direction = "backward"; //$NON-NLS-1$ break; case
+ * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS: direction = "upCycle";
+ * //$NON-NLS-1$ break; case KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS:
+ * direction = "downCycle"; //$NON-NLS-1$ break; } propName = direction +
+ * propName; } finally { toolkit.unlockAWT(); } firePropertyChange(propName,
+ * oldTraversalKeys, keystrokes); }
+ */
/**
* Sets the focus traversal keys state for this component.
*
- * @param value true if the focus traversal keys state is enabled,
- * false if the focus traversal keys state is disabled.
+ * @param value
+ * true if the focus traversal keys state is enabled, false if
+ * the focus traversal keys state is disabled.
*/
public void setFocusTraversalKeysEnabled(boolean value) {
boolean oldFocusTraversalKeysEnabled;
@@ -4368,38 +4038,23 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
focusTraversalKeysEnabled);
}
- //???AWT
+ // ???AWT
/*
- public void setFocusable(boolean focusable) {
- boolean oldFocusable;
- toolkit.lockAWT();
- try {
- calledSetFocusable = true;
- oldFocusable = this.focusable;
- this.focusable = focusable;
- if (!focusable) {
- moveFocus();
- }
- } finally {
- toolkit.unlockAWT();
- }
- firePropertyChange("focusable", oldFocusable, focusable); //$NON-NLS-1$
- }
-
- public Font getFont() {
- toolkit.lockAWT();
- try {
- return (font == null) && (parent != null) ? parent.getFont() : font;
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
+ * public void setFocusable(boolean focusable) { boolean oldFocusable;
+ * toolkit.lockAWT(); try { calledSetFocusable = true; oldFocusable =
+ * this.focusable; this.focusable = focusable; if (!focusable) {
+ * moveFocus(); } } finally { toolkit.unlockAWT(); }
+ * firePropertyChange("focusable", oldFocusable, focusable); //$NON-NLS-1$ }
+ * public Font getFont() { toolkit.lockAWT(); try { return (font == null) &&
+ * (parent != null) ? parent.getFont() : font; } finally {
+ * toolkit.unlockAWT(); } }
+ */
/**
* Sets the font for this Component.
*
- * @param f the new font of the Component.
+ * @param f
+ * the new font of the Component.
*/
public void setFont(Font f) {
Font oldFont;
@@ -4416,7 +4071,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the font impl.
*
- * @param f the new font impl
+ * @param f
+ * the new font impl.
*/
void setFontImpl(Font f) {
font = f;
@@ -4426,12 +4082,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
-
/**
* Invalidate the component if it inherits the font from the parent. This
* method is overridden in Container.
*
- * @return true if the component was invalidated, false otherwise
+ * @return true if the component was invalidated, false otherwise.
*/
boolean propagateFont() {
if (font == null) {
@@ -4444,7 +4099,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the foreground color for this Component.
*
- * @param c the new foreground color.
+ * @param c
+ * the new foreground color.
*/
public void setForeground(Color c) {
Color oldFgColor;
@@ -4462,7 +4118,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the background color for the Component.
*
- * @param c the new background color for this component.
+ * @param c
+ * the new background color for this component.
*/
public void setBackground(Color c) {
Color oldBkColor;
@@ -4478,11 +4135,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Sets the flag for whether paint messages received from the operating
- * system should be ignored or not.
+ * Sets the flag for whether paint messages received from the operating
+ * system should be ignored or not.
*
- * @param value true if paint messages received from the operating
- * system should be ignored, false otherwise.
+ * @param value
+ * true if paint messages received from the operating system
+ * should be ignored, false otherwise.
*/
public void setIgnoreRepaint(boolean value) {
toolkit.lockAWT();
@@ -4496,7 +4154,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the locale of the component.
*
- * @param locale the new Locale.
+ * @param locale
+ * the new Locale.
*/
public void setLocale(Locale locale) {
Locale oldLocale;
@@ -4513,7 +4172,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the location of the Component to the specified point.
*
- * @param p the new location of the Component
+ * @param p
+ * the new location of the Component.
*/
public void setLocation(Point p) {
toolkit.lockAWT();
@@ -4525,10 +4185,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Sets the location of the Component to the specified x, y coordinates.
+ * Sets the location of the Component to the specified x, y coordinates.
*
- * @param x the x coordinate.
- * @param y the y coordinate.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
*/
public void setLocation(int x, int y) {
toolkit.lockAWT();
@@ -4542,8 +4204,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the visibility state of the component.
*
- * @param b true if the component is visible, false if the component
- * is not shown.
+ * @param b
+ * true if the component is visible, false if the component is
+ * not shown.
*/
public void setVisible(boolean b) {
// show() & hide() are not deprecated for Window,
@@ -4569,9 +4232,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
visible = true;
behaviour.setVisible(true);
postEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_SHOWN));
- //???AWT: finishHierarchyChange(this, parent, 0);
+ // ???AWT: finishHierarchyChange(this, parent, 0);
notifyInputMethod(new Rectangle(x, y, w, h));
- //???AWT: invalidateRealParent();
+ // ???AWT: invalidateRealParent();
} finally {
toolkit.unlockAWT();
}
@@ -4580,8 +4243,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Deprecated: replaced by setVisible(boolean) method.
*
- * @param b the visibility's state.
- *
+ * @param b
+ * the visibility's state.
* @deprecated Replaced by setVisible(boolean) method.
*/
@Deprecated
@@ -4593,97 +4256,40 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT
+ // ???AWT
/*
- void transferFocus(int dir) {
- Container root = null;
- if (this instanceof Container) {
- Container cont = (Container) this;
- if (cont.isFocusCycleRoot()) {
- root = cont.getFocusTraversalRoot();
- }
- }
- if (root == null) {
- root = getFocusCycleRootAncestor();
- }
- // transfer focus up cycle if root is unreachable
- Component comp = this;
- while ((root != null)
- && !(root.isFocusCycleRoot() && root.isShowing() && root.isEnabled() && root
- .isFocusable())) {
- comp = root;
- root = root.getFocusCycleRootAncestor();
- }
- if (root == null) {
- return;
- }
- FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
- Component nextComp = null;
- switch (dir) {
- case KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS:
- nextComp = policy.getComponentAfter(root, comp);
- break;
- case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS:
- nextComp = policy.getComponentBefore(root, comp);
- break;
- }
- if (nextComp != null) {
- nextComp.requestFocus(false);
- }
- }
-
- public void transferFocus() {
- toolkit.lockAWT();
- try {
- nextFocus();
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void transferFocusBackward() {
- toolkit.lockAWT();
- try {
- transferFocus(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- public void transferFocusUpCycle() {
- toolkit.lockAWT();
- try {
- KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
- Container root = kfm.getCurrentFocusCycleRoot();
-
- if(root == null) {
- return;
- }
-
- boolean success = false;
- Component nextComp = null;
- Container newRoot = root;
- do {
- nextComp = newRoot instanceof Window ? newRoot.getFocusTraversalPolicy()
- .getDefaultComponent(newRoot) : newRoot;
- newRoot = newRoot.getFocusCycleRootAncestor();
- if (nextComp == null) {
- break;
- }
- success = nextComp.requestFocusInWindow();
- if (newRoot == null) {
- break;
- }
- kfm.setGlobalCurrentFocusCycleRoot(newRoot);
- } while (!success);
- if (!success && root != newRoot) {
- kfm.setGlobalCurrentFocusCycleRoot(root);
- }
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
+ * void transferFocus(int dir) { Container root = null; if (this instanceof
+ * Container) { Container cont = (Container) this; if
+ * (cont.isFocusCycleRoot()) { root = cont.getFocusTraversalRoot(); } } if
+ * (root == null) { root = getFocusCycleRootAncestor(); } // transfer focus
+ * up cycle if root is unreachable Component comp = this; while ((root !=
+ * null) && !(root.isFocusCycleRoot() && root.isShowing() &&
+ * root.isEnabled() && root .isFocusable())) { comp = root; root =
+ * root.getFocusCycleRootAncestor(); } if (root == null) { return; }
+ * FocusTraversalPolicy policy = root.getFocusTraversalPolicy(); Component
+ * nextComp = null; switch (dir) { case
+ * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS: nextComp =
+ * policy.getComponentAfter(root, comp); break; case
+ * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS: nextComp =
+ * policy.getComponentBefore(root, comp); break; } if (nextComp != null) {
+ * nextComp.requestFocus(false); } } public void transferFocus() {
+ * toolkit.lockAWT(); try { nextFocus(); } finally { toolkit.unlockAWT(); }
+ * } public void transferFocusBackward() { toolkit.lockAWT(); try {
+ * transferFocus(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); } finally {
+ * toolkit.unlockAWT(); } } public void transferFocusUpCycle() {
+ * toolkit.lockAWT(); try { KeyboardFocusManager kfm =
+ * KeyboardFocusManager.getCurrentKeyboardFocusManager(); Container root =
+ * kfm.getCurrentFocusCycleRoot(); if(root == null) { return; } boolean
+ * success = false; Component nextComp = null; Container newRoot = root; do
+ * { nextComp = newRoot instanceof Window ?
+ * newRoot.getFocusTraversalPolicy() .getDefaultComponent(newRoot) :
+ * newRoot; newRoot = newRoot.getFocusCycleRootAncestor(); if (nextComp ==
+ * null) { break; } success = nextComp.requestFocusInWindow(); if (newRoot
+ * == null) { break; } kfm.setGlobalCurrentFocusCycleRoot(newRoot); } while
+ * (!success); if (!success && root != newRoot) {
+ * kfm.setGlobalCurrentFocusCycleRoot(root); } } finally {
+ * toolkit.unlockAWT(); } }
+ */
/**
* Validates that this component has a valid layout.
@@ -4710,7 +4316,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the native window.
*
- * @return the native window
+ * @return the native window.
*/
NativeWindow getNativeWindow() {
return behaviour.getNativeWindow();
@@ -4719,8 +4325,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks whether or not a maximum size is set for the Component.
*
- * @return true, if the maximum size is set for the Component,
- * false otherwise.
+ * @return true, if the maximum size is set for the Component, false
+ * otherwise.
*/
public boolean isMaximumSizeSet() {
toolkit.lockAWT();
@@ -4734,8 +4340,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks whether or not the minimum size is set for the component.
*
- * @return true, if the minimum size is set for the component,
- * false otherwise.
+ * @return true, if the minimum size is set for the component, false
+ * otherwise.
*/
public boolean isMinimumSizeSet() {
toolkit.lockAWT();
@@ -4749,8 +4355,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks whether or not the preferred size is set for the Component.
*
- * @return true, if the preferred size is set for the Component,
- * false otherwise.
+ * @return true, if the preferred size is set for the Component, false
+ * otherwise.
*/
public boolean isPreferredSizeSet() {
toolkit.lockAWT();
@@ -4769,8 +4375,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
public Dimension getMaximumSize() {
toolkit.lockAWT();
try {
- return isMaximumSizeSet() ? new Dimension(maximumSize) : new Dimension(
- Short.MAX_VALUE, Short.MAX_VALUE);
+ return isMaximumSizeSet() ? new Dimension(maximumSize) : new Dimension(Short.MAX_VALUE,
+ Short.MAX_VALUE);
} finally {
toolkit.unlockAWT();
}
@@ -4794,7 +4400,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Deprecated: replaced by getMinimumSize() method.
*
* @return the Dimension.
- *
* @deprecated Replaced by getMinimumSize() method.
*/
@Deprecated
@@ -4808,7 +4413,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
if (defSize != null) {
return (Dimension)defSize.clone();
}
- return isDisplayable()? new Dimension(1, 1) : new Dimension(w, h);
+ return isDisplayable() ? new Dimension(1, 1) : new Dimension(w, h);
} finally {
toolkit.unlockAWT();
}
@@ -4832,7 +4437,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Deprecated: replaced by getPreferredSize() method.
*
* @return the Dimension.
- *
* @deprecated Replaced by getPreferredSize() method.
*/
@Deprecated
@@ -4855,7 +4459,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the maximum size of the Component.
*
- * @param maximumSize the new maximum size of the Component.
+ * @param maximumSize
+ * the new maximum size of the Component.
*/
public void setMaximumSize(Dimension maximumSize) {
Dimension oldMaximumSize;
@@ -4882,7 +4487,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
firePropertyChange("maximumSize", oldMaximumSize, this.maximumSize); //$NON-NLS-1$
toolkit.lockAWT();
try {
- //???AWT: invalidateRealParent();
+ // ???AWT: invalidateRealParent();
} finally {
toolkit.unlockAWT();
}
@@ -4891,7 +4496,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the minimum size of the Component.
*
- * @param minimumSize the new minimum size of the Component.
+ * @param minimumSize
+ * the new minimum size of the Component.
*/
public void setMinimumSize(Dimension minimumSize) {
Dimension oldMinimumSize;
@@ -4918,7 +4524,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
firePropertyChange("minimumSize", oldMinimumSize, this.minimumSize); //$NON-NLS-1$
toolkit.lockAWT();
try {
- //???AWT: invalidateRealParent();
+ // ???AWT: invalidateRealParent();
} finally {
toolkit.unlockAWT();
}
@@ -4927,7 +4533,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Sets the preferred size of the Component.
*
- * @param preferredSize the new preferred size of the Component.
+ * @param preferredSize
+ * the new preferred size of the Component.
*/
public void setPreferredSize(Dimension preferredSize) {
Dimension oldPreferredSize;
@@ -4954,47 +4561,38 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
firePropertyChange("preferredSize", oldPreferredSize, this.preferredSize); //$NON-NLS-1$
toolkit.lockAWT();
try {
- //???AWT: invalidateRealParent();
+ // ???AWT: invalidateRealParent();
} finally {
toolkit.unlockAWT();
}
}
- //???AWT
+ // ???AWT
/*
- RedrawManager getRedrawManager() {
- if (parent == null) {
- return null;
- }
- return parent.getRedrawManager();
- }
- */
+ * RedrawManager getRedrawManager() { if (parent == null) { return null; }
+ * return parent.getRedrawManager(); }
+ */
/**
* Checks if is focusability explicitly set.
*
- * @return true if component has a focusable peer
+ * @return true if component has a focusable peer.
*/
- //???AWT
+ // ???AWT
/*
- boolean isPeerFocusable() {
- // The recommendations for Windows and Unix are that
- // Canvases, Labels, Panels, Scrollbars, ScrollPanes, Windows,
- // and lightweight Components have non-focusable peers,
- // and all other Components have focusable peers.
- if (this instanceof Canvas || this instanceof Label || this instanceof Panel
- || this instanceof Scrollbar || this instanceof ScrollPane
- || this instanceof Window || isLightweight()) {
- return false;
- }
- return true;
- }
- */
+ * boolean isPeerFocusable() { // The recommendations for Windows and Unix
+ * are that // Canvases, Labels, Panels, Scrollbars, ScrollPanes, Windows,
+ * // and lightweight Components have non-focusable peers, // and all other
+ * Components have focusable peers. if (this instanceof Canvas || this
+ * instanceof Label || this instanceof Panel || this instanceof Scrollbar ||
+ * this instanceof ScrollPane || this instanceof Window || isLightweight())
+ * { return false; } return true; }
+ */
/**
* @return true if focusability was explicitly set via a call to
* setFocusable() or via overriding isFocusable() or
- * isFocusTraversable()
+ * isFocusTraversable().
*/
boolean isFocusabilityExplicitlySet() {
return calledSetFocusable || overridenIsFocusable;
@@ -5003,7 +4601,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Paints the component and all of its subcomponents.
*
- * @param g the Graphics to be used for painting.
+ * @param g
+ * the Graphics to be used for painting.
*/
public void paintAll(Graphics g) {
toolkit.lockAWT();
@@ -5017,7 +4616,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Updates this Component.
*
- * @param g the Graphics to be used for updating.
+ * @param g
+ * the Graphics to be used for updating.
*/
public void update(Graphics g) {
toolkit.lockAWT();
@@ -5036,7 +4636,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Paints this component.
*
- * @param g the Graphics to be used for painting.
+ * @param g
+ * the Graphics to be used for painting.
*/
public void paint(Graphics g) {
toolkit.lockAWT();
@@ -5050,7 +4651,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Prepares the component to be painted.
*
- * @param g the Graphics to be used for painting.
+ * @param g
+ * the Graphics to be used for painting.
*/
void prepaint(Graphics g) {
// Just to nothing. For overriding.
@@ -5059,7 +4661,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if is prepainter.
*
- * @return true, if is prepainter
+ * @return true, if is prepainter.
*/
boolean isPrepainter() {
return false;
@@ -5083,41 +4685,29 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
// To be inherited by Container
}
- //???AWT
+ // ???AWT
/*
- void finishHierarchyChange(Component changed, Container changedParent, int ancestorFlags) {
- if (--hierarchyChangingCounter == 0) {
- int changeFlags = ancestorFlags;
- if (wasShowing != isShowing()) {
- changeFlags |= HierarchyEvent.SHOWING_CHANGED;
- }
- if (wasDisplayable != isDisplayable()) {
- changeFlags |= HierarchyEvent.DISPLAYABILITY_CHANGED;
- }
- if (changeFlags > 0) {
- postEvent(new HierarchyEvent(this, HierarchyEvent.HIERARCHY_CHANGED, changed,
- changedParent, changeFlags));
- }
- finishChildrenHierarchyChange(changed, changedParent, ancestorFlags);
- }
- }
-
-
- void finishChildrenHierarchyChange(Component changed, Container changedParent,
- int ancestorFlags) {
- // To be inherited by Container
- }
+ * void finishHierarchyChange(Component changed, Container changedParent,
+ * int ancestorFlags) { if (--hierarchyChangingCounter == 0) { int
+ * changeFlags = ancestorFlags; if (wasShowing != isShowing()) { changeFlags
+ * |= HierarchyEvent.SHOWING_CHANGED; } if (wasDisplayable !=
+ * isDisplayable()) { changeFlags |= HierarchyEvent.DISPLAYABILITY_CHANGED;
+ * } if (changeFlags > 0) { postEvent(new HierarchyEvent(this,
+ * HierarchyEvent.HIERARCHY_CHANGED, changed, changedParent, changeFlags));
+ * } finishChildrenHierarchyChange(changed, changedParent, ancestorFlags); }
+ * } void finishChildrenHierarchyChange(Component changed, Container
+ * changedParent, int ancestorFlags) { // To be inherited by Container }
+ * void postHierarchyBoundsEvents(Component changed, int id) { postEvent(new
+ * HierarchyEvent(this, id, changed, null, 0)); }
+ */
- void postHierarchyBoundsEvents(Component changed, int id) {
- postEvent(new HierarchyEvent(this, id, changed, null, 0));
- }
- */
-
/**
* Spread hierarchy bounds events.
*
- * @param changed the changed
- * @param id the id
+ * @param changed
+ * the changed.
+ * @param id
+ * the id.
*/
void spreadHierarchyBoundsEvents(Component changed, int id) {
// To be inherited by Container
@@ -5126,59 +4716,40 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Dispatches an event to this component.
*
- * @param e the Event.
+ * @param e
+ * the Event.
*/
public final void dispatchEvent(AWTEvent e) {
- //???AWT
+ // ???AWT
/*
- if (e.isConsumed()) {
- return;
- }
- if (e instanceof PaintEvent) {
- toolkit.dispatchAWTEvent(e);
- processPaintEvent((PaintEvent) e);
- return;
- }
- KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
- if (!e.dispatchedByKFM && kfm.dispatchEvent(e)) {
- return;
- }
- if (e instanceof KeyEvent) {
- KeyEvent ke = (KeyEvent) e;
- // consumes KeyEvent which represents a focus traversal key
- if (getFocusTraversalKeysEnabled()) {
- kfm.processKeyEvent(this, ke);
- if (ke.isConsumed()) {
- return;
- }
- }
- }
- if (inputMethodsEnabled && dispatchToIM && e.isPosted && dispatchEventToIM(e)) {
- return;
- }
- if (e.getID() == WindowEvent.WINDOW_ICONIFIED) {
- notifyInputMethod(null);
- }
- AWTEvent.EventDescriptor descriptor = toolkit.eventTypeLookup.getEventDescriptor(e);
- toolkit.dispatchAWTEvent(e);
- if (descriptor != null) {
- if (isEventEnabled(descriptor.eventMask)
- || (getListeners(descriptor.listenerType).length > 0)) {
- processEvent(e);
- }
- // input events can be consumed by user listeners:
- if (!e.isConsumed() && ((enabledAWTEvents & descriptor.eventMask) != 0)) {
- postprocessEvent(e, descriptor.eventMask);
- }
- }
- postDeprecatedEvent(e);
- */
+ * if (e.isConsumed()) { return; } if (e instanceof PaintEvent) {
+ * toolkit.dispatchAWTEvent(e); processPaintEvent((PaintEvent) e);
+ * return; } KeyboardFocusManager kfm =
+ * KeyboardFocusManager.getCurrentKeyboardFocusManager(); if
+ * (!e.dispatchedByKFM && kfm.dispatchEvent(e)) { return; } if (e
+ * instanceof KeyEvent) { KeyEvent ke = (KeyEvent) e; // consumes
+ * KeyEvent which represents a focus traversal key if
+ * (getFocusTraversalKeysEnabled()) { kfm.processKeyEvent(this, ke); if
+ * (ke.isConsumed()) { return; } } } if (inputMethodsEnabled &&
+ * dispatchToIM && e.isPosted && dispatchEventToIM(e)) { return; } if
+ * (e.getID() == WindowEvent.WINDOW_ICONIFIED) {
+ * notifyInputMethod(null); } AWTEvent.EventDescriptor descriptor =
+ * toolkit.eventTypeLookup.getEventDescriptor(e);
+ * toolkit.dispatchAWTEvent(e); if (descriptor != null) { if
+ * (isEventEnabled(descriptor.eventMask) ||
+ * (getListeners(descriptor.listenerType).length > 0)) {
+ * processEvent(e); } // input events can be consumed by user listeners:
+ * if (!e.isConsumed() && ((enabledAWTEvents & descriptor.eventMask) !=
+ * 0)) { postprocessEvent(e, descriptor.eventMask); } }
+ * postDeprecatedEvent(e);
+ */
}
/**
* Post deprecated event.
*
- * @param e the e
+ * @param e
+ * the e.
*/
private void postDeprecatedEvent(AWTEvent e) {
if (deprecatedEventHandler) {
@@ -5192,27 +4763,29 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Postprocess event.
*
- * @param e the e
- * @param eventMask the event mask
+ * @param e
+ * the e.
+ * @param eventMask
+ * the event mask.
*/
void postprocessEvent(AWTEvent e, long eventMask) {
toolkit.lockAWT();
try {
// call system listeners under AWT lock
if (eventMask == AWTEvent.FOCUS_EVENT_MASK) {
- preprocessFocusEvent((FocusEvent) e);
+ preprocessFocusEvent((FocusEvent)e);
} else if (eventMask == AWTEvent.KEY_EVENT_MASK) {
- preprocessKeyEvent((KeyEvent) e);
+ preprocessKeyEvent((KeyEvent)e);
} else if (eventMask == AWTEvent.MOUSE_EVENT_MASK) {
- preprocessMouseEvent((MouseEvent) e);
+ preprocessMouseEvent((MouseEvent)e);
} else if (eventMask == AWTEvent.MOUSE_MOTION_EVENT_MASK) {
- preprocessMouseMotionEvent((MouseEvent) e);
+ preprocessMouseMotionEvent((MouseEvent)e);
} else if (eventMask == AWTEvent.COMPONENT_EVENT_MASK) {
- preprocessComponentEvent((ComponentEvent) e);
+ preprocessComponentEvent((ComponentEvent)e);
} else if (eventMask == AWTEvent.MOUSE_WHEEL_EVENT_MASK) {
- preprocessMouseWheelEvent((MouseWheelEvent) e);
+ preprocessMouseWheelEvent((MouseWheelEvent)e);
} else if (eventMask == AWTEvent.INPUT_METHOD_EVENT_MASK) {
- preprocessInputMethodEvent((InputMethodEvent) e);
+ preprocessInputMethodEvent((InputMethodEvent)e);
}
} finally {
toolkit.unlockAWT();
@@ -5222,7 +4795,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Preprocess input method event.
*
- * @param e the e
+ * @param e
+ * the e.
*/
private void preprocessInputMethodEvent(InputMethodEvent e) {
processInputMethodEventImpl(e, inputMethodListeners.getSystemListeners());
@@ -5231,7 +4805,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Preprocess mouse wheel event.
*
- * @param e the e
+ * @param e
+ * the e.
*/
private void preprocessMouseWheelEvent(MouseWheelEvent e) {
processMouseWheelEventImpl(e, mouseWheelListeners.getSystemListeners());
@@ -5240,8 +4815,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Process mouse wheel event impl.
*
- * @param e the e
- * @param c the c
+ * @param e
+ * the e.
+ * @param c
+ * the c.
*/
private void processMouseWheelEventImpl(MouseWheelEvent e, Collection c) {
for (MouseWheelListener listener : c) {
@@ -5256,7 +4833,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Preprocess component event.
*
- * @param e the e
+ * @param e
+ * the e.
*/
private void preprocessComponentEvent(ComponentEvent e) {
processComponentEventImpl(e, componentListeners.getSystemListeners());
@@ -5265,7 +4843,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Preprocess mouse motion event.
*
- * @param e the e
+ * @param e
+ * the e.
*/
void preprocessMouseMotionEvent(MouseEvent e) {
processMouseMotionEventImpl(e, mouseMotionListeners.getSystemListeners());
@@ -5274,7 +4853,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Preprocess mouse event.
*
- * @param e the e
+ * @param e
+ * the e
*/
void preprocessMouseEvent(MouseEvent e) {
processMouseEventImpl(e, mouseListeners.getSystemListeners());
@@ -5283,7 +4863,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Preprocess key event.
*
- * @param e the e
+ * @param e
+ * the e.
*/
void preprocessKeyEvent(KeyEvent e) {
processKeyEventImpl(e, keyListeners.getSystemListeners());
@@ -5292,79 +4873,82 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Preprocess focus event.
*
- * @param e the e
+ * @param e
+ * the e.
*/
void preprocessFocusEvent(FocusEvent e) {
processFocusEventImpl(e, focusListeners.getSystemListeners());
}
/**
- * Processes AWTEvent occurred on this component.
+ * Processes AWTEvent occurred on this component.
*
- * @param e the AWTEvent.
+ * @param e
+ * the AWTEvent.
*/
protected void processEvent(AWTEvent e) {
long eventMask = toolkit.eventTypeLookup.getEventMask(e);
if (eventMask == AWTEvent.COMPONENT_EVENT_MASK) {
- processComponentEvent((ComponentEvent) e);
+ processComponentEvent((ComponentEvent)e);
} else if (eventMask == AWTEvent.FOCUS_EVENT_MASK) {
- processFocusEvent((FocusEvent) e);
+ processFocusEvent((FocusEvent)e);
} else if (eventMask == AWTEvent.KEY_EVENT_MASK) {
- processKeyEvent((KeyEvent) e);
+ processKeyEvent((KeyEvent)e);
} else if (eventMask == AWTEvent.MOUSE_EVENT_MASK) {
- processMouseEvent((MouseEvent) e);
+ processMouseEvent((MouseEvent)e);
} else if (eventMask == AWTEvent.MOUSE_WHEEL_EVENT_MASK) {
- processMouseWheelEvent((MouseWheelEvent) e);
+ processMouseWheelEvent((MouseWheelEvent)e);
} else if (eventMask == AWTEvent.MOUSE_MOTION_EVENT_MASK) {
- processMouseMotionEvent((MouseEvent) e);
+ processMouseMotionEvent((MouseEvent)e);
} else if (eventMask == AWTEvent.HIERARCHY_EVENT_MASK) {
- processHierarchyEvent((HierarchyEvent) e);
+ processHierarchyEvent((HierarchyEvent)e);
} else if (eventMask == AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) {
- processHierarchyBoundsEvent((HierarchyEvent) e);
+ processHierarchyBoundsEvent((HierarchyEvent)e);
} else if (eventMask == AWTEvent.INPUT_METHOD_EVENT_MASK) {
- processInputMethodEvent((InputMethodEvent) e);
+ processInputMethodEvent((InputMethodEvent)e);
}
}
/**
- * Gets an array of all listener's objects based on the specified
- * listener type and registered to this Component.
- *
- * @param listenerType the listener type.
+ * Gets an array of all listener's objects based on the specified listener
+ * type and registered to this Component.
*
+ * @param listenerType
+ * the listener type.
* @return an array of all listener's objects based on the specified
- * listener type and registered to this Component.
+ * listener type and registered to this Component.
*/
@SuppressWarnings("unchecked")
public T[] getListeners(Class listenerType) {
if (ComponentListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getComponentListeners();
+ return (T[])getComponentListeners();
} else if (FocusListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getFocusListeners();
+ return (T[])getFocusListeners();
} else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getHierarchyBoundsListeners();
+ return (T[])getHierarchyBoundsListeners();
} else if (HierarchyListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getHierarchyListeners();
+ return (T[])getHierarchyListeners();
} else if (InputMethodListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getInputMethodListeners();
+ return (T[])getInputMethodListeners();
} else if (KeyListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getKeyListeners();
+ return (T[])getKeyListeners();
} else if (MouseWheelListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getMouseWheelListeners();
+ return (T[])getMouseWheelListeners();
} else if (MouseMotionListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getMouseMotionListeners();
+ return (T[])getMouseMotionListeners();
} else if (MouseListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getMouseListeners();
+ return (T[])getMouseListeners();
} else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) {
- return (T[]) getPropertyChangeListeners();
+ return (T[])getPropertyChangeListeners();
}
- return (T[]) Array.newInstance(listenerType, 0);
+ return (T[])Array.newInstance(listenerType, 0);
}
/**
* Process paint event.
*
- * @param event the event
+ * @param event
+ * the event.
*/
private void processPaintEvent(PaintEvent event) {
if (redrawManager == null) {
@@ -5392,13 +4976,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Inits the graphics.
*
- * @param g the g
- * @param e the e
+ * @param g
+ * the g.
+ * @param e
+ * the e.
*/
void initGraphics(Graphics g, PaintEvent e) {
Rectangle clip = e.getUpdateRect();
if (clip instanceof ClipRegion) {
- g.setClip(((ClipRegion) clip).getClip());
+ g.setClip(((ClipRegion)clip).getClip());
} else {
g.setClip(clip);
}
@@ -5413,11 +4999,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Enables the events with the specified event mask to be delivered to
- * this component.
+ * Enables the events with the specified event mask to be delivered to this
+ * component.
*
- * @param eventsToEnable the events mask which specifies the types
- * of events to enable.
+ * @param eventsToEnable
+ * the events mask which specifies the types of events to enable.
*/
protected final void enableEvents(long eventsToEnable) {
toolkit.lockAWT();
@@ -5432,17 +5018,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Enable awt events.
*
- * @param eventsToEnable the events to enable
+ * @param eventsToEnable
+ * the events to enable.
*/
private void enableAWTEvents(long eventsToEnable) {
enabledAWTEvents |= eventsToEnable;
}
/**
- * Disables the events with types specified by the specified event mask
- * from being delivered to this component.
+ * Disables the events with types specified by the specified event mask from
+ * being delivered to this component.
*
- * @param eventsToDisable the event mask specifying the event types.
+ * @param eventsToDisable
+ * the event mask specifying the event types.
*/
protected final void disableEvents(long eventsToDisable) {
toolkit.lockAWT();
@@ -5459,9 +5047,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if is mouse event enabled.
*
- * @param eventMask the event mask
- *
- * @return true, if is mouse event enabled
+ * @param eventMask
+ * the event mask.
+ * @return true, if is mouse event enabled.
*/
boolean isMouseEventEnabled(long eventMask) {
return (isEventEnabled(eventMask) || (enabledAWTEvents & eventMask) != 0);
@@ -5470,18 +5058,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Checks if is event enabled.
*
- * @param eventMask the event mask
- *
- * @return true, if is event enabled
+ * @param eventMask
+ * the event mask.
+ * @return true, if is event enabled.
*/
boolean isEventEnabled(long eventMask) {
return ((enabledEvents & eventMask) != 0);
}
/**
- * Enables or disables input method support for this component.
+ * Enables or disables input method support for this component.
*
- * @param enable true to enable input method support, false to disable it.
+ * @param enable
+ * true to enable input method support, false to disable it.
*/
public void enableInputMethods(boolean enable) {
toolkit.lockAWT();
@@ -5496,11 +5085,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets an array of all component's listeners registered for this
- * component.
+ * Gets an array of all component's listeners registered for this component.
*
* @return an array of all component's listeners registered for this
- * component.
+ * component.
*/
public ComponentListener[] getComponentListeners() {
return componentListeners.getUserListeners(new ComponentListener[0]);
@@ -5510,7 +5098,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Adds the specified component listener to the Component for receiving
* component's event.
*
- * @param l the ComponentListener.
+ * @param l
+ * the ComponentListener.
*/
public void addComponentListener(ComponentListener l) {
componentListeners.addUserListener(l);
@@ -5519,17 +5108,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the component listener registered for this Component.
*
- * @param l the ComponentListener.
+ * @param l
+ * the ComponentListener.
*/
public void removeComponentListener(ComponentListener l) {
componentListeners.removeUserListener(l);
}
/**
- * Processes a component event that has occurred on this component
- * by dispatching them to any registered ComponentListener objects.
+ * Processes a component event that has occurred on this component by
+ * dispatching them to any registered ComponentListener objects.
*
- * @param e the ComponentEvent.
+ * @param e
+ * the ComponentEvent.
*/
protected void processComponentEvent(ComponentEvent e) {
processComponentEventImpl(e, componentListeners.getUserListeners());
@@ -5538,8 +5129,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Process component event impl.
*
- * @param e the e
- * @param c the c
+ * @param e
+ * the e.
+ * @param c
+ * the c.
*/
private void processComponentEventImpl(ComponentEvent e, Collection c) {
for (ComponentListener listener : c) {
@@ -5570,10 +5163,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Adds the specified focus listener to the Component for receiving
- * focus events.
+ * Adds the specified focus listener to the Component for receiving focus
+ * events.
*
- * @param l the FocusListener.
+ * @param l
+ * the FocusListener.
*/
public void addFocusListener(FocusListener l) {
focusListeners.addUserListener(l);
@@ -5582,7 +5176,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the awt focus listener.
*
- * @param l the l
+ * @param l
+ * the l.
*/
void addAWTFocusListener(FocusListener l) {
enableAWTEvents(AWTEvent.FOCUS_EVENT_MASK);
@@ -5592,17 +5187,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the focus listener registered for this Component.
*
- * @param l the FocusListener.
+ * @param l
+ * the FocusListener.
*/
public void removeFocusListener(FocusListener l) {
focusListeners.removeUserListener(l);
}
/**
- * Processes a FocusEvent that has occurred on this component
- * by dispatching it to the registered listeners.
- *
- * @param e the FocusEvent.
+ * Processes a FocusEvent that has occurred on this component by dispatching
+ * it to the registered listeners.
+ *
+ * @param e
+ * the FocusEvent.
*/
protected void processFocusEvent(FocusEvent e) {
processFocusEventImpl(e, focusListeners.getUserListeners());
@@ -5611,8 +5208,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Process focus event impl.
*
- * @param e the e
- * @param c the c
+ * @param e
+ * the e.
+ * @param c
+ * the c.
*/
private void processFocusEventImpl(FocusEvent e, Collection c) {
for (FocusListener listener : c) {
@@ -5628,11 +5227,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets an array of registered HierarchyListeners for
- * this Component.
+ * Gets an array of registered HierarchyListeners for this Component.
*
- * @return an array of registered HierarchyListeners for
- * this Component.
+ * @return an array of registered HierarchyListeners for this Component.
*/
public HierarchyListener[] getHierarchyListeners() {
return hierarchyListeners.getUserListeners(new HierarchyListener[0]);
@@ -5641,7 +5238,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the specified hierarchy listener.
*
- * @param l the HierarchyListener.
+ * @param l
+ * the HierarchyListener.
*/
public void addHierarchyListener(HierarchyListener l) {
hierarchyListeners.addUserListener(l);
@@ -5650,17 +5248,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the hierarchy listener registered for this component.
*
- * @param l the HierarchyListener.
+ * @param l
+ * the HierarchyListener.
*/
public void removeHierarchyListener(HierarchyListener l) {
hierarchyListeners.removeUserListener(l);
}
/**
- * Processes a hierarchy event that has occurred on this component
- * by dispatching it to the registered listeners.
+ * Processes a hierarchy event that has occurred on this component by
+ * dispatching it to the registered listeners.
*
- * @param e the HierarchyEvent.
+ * @param e
+ * the HierarchyEvent.
*/
protected void processHierarchyEvent(HierarchyEvent e) {
for (HierarchyListener listener : hierarchyListeners.getUserListeners()) {
@@ -5673,8 +5273,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets an array of HierarchyBoundsListener objects registered
- * to this Component.
+ * Gets an array of HierarchyBoundsListener objects registered to this
+ * Component.
*
* @return an array of HierarchyBoundsListener objects.
*/
@@ -5685,7 +5285,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the specified hierarchy bounds listener.
*
- * @param l the HierarchyBoundsListener.
+ * @param l
+ * the HierarchyBoundsListener.
*/
public void addHierarchyBoundsListener(HierarchyBoundsListener l) {
hierarchyBoundsListeners.addUserListener(l);
@@ -5694,17 +5295,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the hierarchy bounds listener registered for this Component.
*
- * @param l the HierarchyBoundsListener.
+ * @param l
+ * the HierarchyBoundsListener.
*/
public void removeHierarchyBoundsListener(HierarchyBoundsListener l) {
hierarchyBoundsListeners.removeUserListener(l);
}
/**
- * Processes a hierarchy bounds event that has occurred on this component
- * by dispatching it to the registered listeners.
- *
- * @param e the HierarchyBoundsEvent.
+ * Processes a hierarchy bounds event that has occurred on this component by
+ * dispatching it to the registered listeners.
+ *
+ * @param e
+ * the HierarchyBoundsEvent.
*/
protected void processHierarchyBoundsEvent(HierarchyEvent e) {
for (HierarchyBoundsListener listener : hierarchyBoundsListeners.getUserListeners()) {
@@ -5731,7 +5334,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the specified key listener.
*
- * @param l the KeyListener.
+ * @param l
+ * the KeyListener.
*/
public void addKeyListener(KeyListener l) {
keyListeners.addUserListener(l);
@@ -5740,7 +5344,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the awt key listener.
*
- * @param l the l
+ * @param l
+ * the l.
*/
void addAWTKeyListener(KeyListener l) {
enableAWTEvents(AWTEvent.KEY_EVENT_MASK);
@@ -5750,17 +5355,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the key listener registered for this Component.
*
- * @param l the KeyListener.
+ * @param l
+ * the KeyListener.
*/
public void removeKeyListener(KeyListener l) {
keyListeners.removeUserListener(l);
}
/**
- * Processes a key event that has occurred on this component
- * by dispatching it to the registered listeners.
+ * Processes a key event that has occurred on this component by dispatching
+ * it to the registered listeners.
*
- * @param e the KeyEvent.
+ * @param e
+ * the KeyEvent.
*/
protected void processKeyEvent(KeyEvent e) {
processKeyEventImpl(e, keyListeners.getUserListeners());
@@ -5769,8 +5376,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Process key event impl.
*
- * @param e the e
- * @param c the c
+ * @param e
+ * the e.
+ * @param c
+ * the c.
*/
private void processKeyEventImpl(KeyEvent e, Collection c) {
for (KeyListener listener : c) {
@@ -5800,7 +5409,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the specified mouse listener.
*
- * @param l the MouseListener.
+ * @param l
+ * the MouseListener.
*/
public void addMouseListener(MouseListener l) {
mouseListeners.addUserListener(l);
@@ -5809,7 +5419,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the awt mouse listener.
*
- * @param l the l
+ * @param l
+ * the l.
*/
void addAWTMouseListener(MouseListener l) {
enableAWTEvents(AWTEvent.MOUSE_EVENT_MASK);
@@ -5819,7 +5430,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the awt mouse motion listener.
*
- * @param l the l
+ * @param l
+ * the l.
*/
void addAWTMouseMotionListener(MouseMotionListener l) {
enableAWTEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
@@ -5829,7 +5441,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the awt component listener.
*
- * @param l the l
+ * @param l
+ * the l.
*/
void addAWTComponentListener(ComponentListener l) {
enableAWTEvents(AWTEvent.COMPONENT_EVENT_MASK);
@@ -5839,7 +5452,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the awt input method listener.
*
- * @param l the l
+ * @param l
+ * the l.
*/
void addAWTInputMethodListener(InputMethodListener l) {
enableAWTEvents(AWTEvent.INPUT_METHOD_EVENT_MASK);
@@ -5849,7 +5463,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the awt mouse wheel listener.
*
- * @param l the l
+ * @param l
+ * the l.
*/
void addAWTMouseWheelListener(MouseWheelListener l) {
enableAWTEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK);
@@ -5859,17 +5474,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the mouse listener registered for this Component.
*
- * @param l the MouseListener.
+ * @param l
+ * the MouseListener.
*/
public void removeMouseListener(MouseListener l) {
mouseListeners.removeUserListener(l);
}
/**
- * Processes a mouse event that has occurred on this component
- * by dispatching it to the registered listeners.
+ * Processes a mouse event that has occurred on this component by
+ * dispatching it to the registered listeners.
*
- * @param e the MouseEvent.
+ * @param e
+ * the MouseEvent.
*/
protected void processMouseEvent(MouseEvent e) {
processMouseEventImpl(e, mouseListeners.getUserListeners());
@@ -5878,8 +5495,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Process mouse event impl.
*
- * @param e the e
- * @param c the c
+ * @param e
+ * the e.
+ * @param c
+ * the c.
*/
private void processMouseEventImpl(MouseEvent e, Collection c) {
for (MouseListener listener : c) {
@@ -5906,8 +5525,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Process mouse motion event impl.
*
- * @param e the e
- * @param c the c
+ * @param e
+ * the e.
+ * @param c
+ * the c.
*/
private void processMouseMotionEventImpl(MouseEvent e, Collection c) {
for (MouseMotionListener listener : c) {
@@ -5923,11 +5544,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
/**
- * Gets an array of the mouse motion listeners registered to
- * the Component.
+ * Gets an array of the mouse motion listeners registered to the Component.
*
- * @return an array of the MouseMotionListeners registered to
- * the Component.
+ * @return an array of the MouseMotionListeners registered to the Component.
*/
public MouseMotionListener[] getMouseMotionListeners() {
return mouseMotionListeners.getUserListeners(new MouseMotionListener[0]);
@@ -5936,7 +5555,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the specified mouse motion listener.
*
- * @param l the MouseMotionListener.
+ * @param l
+ * the MouseMotionListener.
*/
public void addMouseMotionListener(MouseMotionListener l) {
mouseMotionListeners.addUserListener(l);
@@ -5945,28 +5565,28 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the mouse motion listener registered for this component.
*
- * @param l the MouseMotionListener.
+ * @param l
+ * the MouseMotionListener.
*/
public void removeMouseMotionListener(MouseMotionListener l) {
mouseMotionListeners.removeUserListener(l);
}
/**
- * Processes a mouse motion event that has occurred on this component
- * by dispatching it to the registered listeners.
+ * Processes a mouse motion event that has occurred on this component by
+ * dispatching it to the registered listeners.
*
- * @param e the MouseEvent.
+ * @param e
+ * the MouseEvent.
*/
protected void processMouseMotionEvent(MouseEvent e) {
processMouseMotionEventImpl(e, mouseMotionListeners.getUserListeners());
}
/**
- * Gets an array of the mouse wheel listeners registered to
- * the Component.
+ * Gets an array of the mouse wheel listeners registered to the Component.
*
- * @return an array of the MouseWheelListeners registered to
- * the Component.
+ * @return an array of the MouseWheelListeners registered to the Component.
*/
public MouseWheelListener[] getMouseWheelListeners() {
return mouseWheelListeners.getUserListeners(new MouseWheelListener[0]);
@@ -5975,7 +5595,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the specified mouse wheel listener.
*
- * @param l the MouseWheelListener.
+ * @param l
+ * the MouseWheelListener.
*/
public void addMouseWheelListener(MouseWheelListener l) {
mouseWheelListeners.addUserListener(l);
@@ -5984,28 +5605,30 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the mouse wheel listener registered for this component.
*
- * @param l the MouseWheelListener.
+ * @param l
+ * the MouseWheelListener.
*/
public void removeMouseWheelListener(MouseWheelListener l) {
mouseWheelListeners.removeUserListener(l);
}
/**
- * Processes a mouse wheel event that has occurred on this component
- * by dispatching it to the registered listeners.
+ * Processes a mouse wheel event that has occurred on this component by
+ * dispatching it to the registered listeners.
*
- * @param e the MouseWheelEvent.
+ * @param e
+ * the MouseWheelEvent.
*/
protected void processMouseWheelEvent(MouseWheelEvent e) {
processMouseWheelEventImpl(e, mouseWheelListeners.getUserListeners());
}
/**
- * Gets an array of the InputMethodListener listeners
- * registered to the Component.
+ * Gets an array of the InputMethodListener listeners registered to the
+ * Component.
*
- * @return an array of the InputMethodListener listeners
- * registered to the Component.
+ * @return an array of the InputMethodListener listeners registered to the
+ * Component.
*/
public InputMethodListener[] getInputMethodListeners() {
return inputMethodListeners.getUserListeners(new InputMethodListener[0]);
@@ -6014,7 +5637,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Adds the specified input method listener.
*
- * @param l the InputMethodListener.
+ * @param l
+ * the InputMethodListener.
*/
public void addInputMethodListener(InputMethodListener l) {
inputMethodListeners.addUserListener(l);
@@ -6023,17 +5647,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Removes the input method listener registered for this component.
*
- * @param l the InputMethodListener.
+ * @param l
+ * the InputMethodListener.
*/
public void removeInputMethodListener(InputMethodListener l) {
inputMethodListeners.removeUserListener(l);
}
/**
- * Processes an input method event that has occurred on this component
- * by dispatching it to the registered listeners.
+ * Processes an input method event that has occurred on this component by
+ * dispatching it to the registered listeners.
*
- * @param e the InputMethodEvent.
+ * @param e
+ * the InputMethodEvent.
*/
protected void processInputMethodEvent(InputMethodEvent e) {
processInputMethodEventImpl(e, inputMethodListeners.getUserListeners());
@@ -6042,11 +5668,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Process input method event impl.
*
- * @param e the e
- * @param c the c
+ * @param e
+ * the e.
+ * @param c
+ * the c.
*/
- private void processInputMethodEventImpl(InputMethodEvent e,
- Collection c) {
+ private void processInputMethodEventImpl(InputMethodEvent e, Collection c) {
for (InputMethodListener listener : c) {
switch (e.getID()) {
case InputMethodEvent.CARET_POSITION_CHANGED:
@@ -6059,31 +5686,28 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT
+ // ???AWT
/*
- public Point getMousePosition() throws HeadlessException {
- Point absPointerPos = MouseInfo.getPointerInfo().getLocation();
- Window winUnderPtr = toolkit.dispatcher.mouseDispatcher.findWindowAt(absPointerPos);
- Point pointerPos = MouseDispatcher.convertPoint(null, absPointerPos, winUnderPtr);
- boolean isUnderPointer = false;
- if (winUnderPtr == null) {
- return null;
- }
- isUnderPointer = winUnderPtr.isComponentAt(this, pointerPos);
- if (isUnderPointer) {
- return MouseDispatcher.convertPoint(null, absPointerPos, this);
- }
- return null;
- }
- */
+ * public Point getMousePosition() throws HeadlessException { Point
+ * absPointerPos = MouseInfo.getPointerInfo().getLocation(); Window
+ * winUnderPtr =
+ * toolkit.dispatcher.mouseDispatcher.findWindowAt(absPointerPos); Point
+ * pointerPos = MouseDispatcher.convertPoint(null, absPointerPos,
+ * winUnderPtr); boolean isUnderPointer = false; if (winUnderPtr == null) {
+ * return null; } isUnderPointer = winUnderPtr.isComponentAt(this,
+ * pointerPos); if (isUnderPointer) { return
+ * MouseDispatcher.convertPoint(null, absPointerPos, this); } return null; }
+ */
/**
* Set native caret at the given position
* Note: this method takes AWT lock inside because it walks through the
* component hierarchy.
*
- * @param x the x
- * @param y the y
+ * @param x
+ * the x.
+ * @param y
+ * the y.
*/
void setCaretPos(final int x, final int y) {
Runnable r = new Runnable() {
@@ -6106,35 +5730,34 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* This method should be called only at event dispatch thread.
*
- * @param x the x
- * @param y the y
+ * @param x
+ * the x.
+ * @param y
+ * the y.
*/
void setCaretPosImpl(int x, int y) {
Component c = this;
while ((c != null) && c.behaviour.isLightweight()) {
x += c.x;
y += c.y;
- //???AWT: c = c.getParent();
+ // ???AWT: c = c.getParent();
}
if (c == null) {
return;
}
- //???AWT
+ // ???AWT
/*
- if (c instanceof Window) {
- Insets insets = c.getNativeInsets();
- x -= insets.left;
- y -= insets.top;
- }
- toolkit.getWindowFactory().setCaretPosition(x, y);
- */
+ * if (c instanceof Window) { Insets insets = c.getNativeInsets(); x -=
+ * insets.left; y -= insets.top; }
+ * toolkit.getWindowFactory().setCaretPosition(x, y);
+ */
}
// to be overridden in standard components such as Button and List
/**
* Gets the default minimum size.
*
- * @return the default minimum size
+ * @return the default minimum size.
*/
Dimension getDefaultMinimumSize() {
return null;
@@ -6144,7 +5767,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Gets the default preferred size.
*
- * @return the default preferred size
+ * @return the default preferred size.
*/
Dimension getDefaultPreferredSize() {
return null;
@@ -6157,30 +5780,28 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
void resetDefaultSize() {
}
- //???AWT
+ // ???AWT
/*
- ComponentBehavior createBehavior() {
- return new LWBehavior(this);
- }
- */
+ * ComponentBehavior createBehavior() { return new LWBehavior(this); }
+ */
/**
* Gets the default background.
*
- * @return the default background
+ * @return the default background.
*/
Color getDefaultBackground() {
- //???AWT: return getWindowAncestor().getDefaultBackground();
+ // ???AWT: return getWindowAncestor().getDefaultBackground();
return getBackground();
}
/**
* Gets the default foreground.
*
- * @return the default foreground
+ * @return the default foreground.
*/
Color getDefaultForeground() {
- //???AWT return getWindowAncestor().getDefaultForeground();
+ // ???AWT return getWindowAncestor().getDefaultForeground();
return getForeground();
}
@@ -6188,7 +5809,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Called when native resource for this component is created (for
* heavyweights only).
*
- * @param win the win
+ * @param win
+ * the win.
*/
void nativeWindowCreated(NativeWindow win) {
// to be overridden
@@ -6198,48 +5820,37 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* Determine the component's area hidden behind the windows that have higher
* Z-order, including windows of other applications.
*
- * @param image the image
- * @param destLocation the dest location
- * @param destSize the dest size
- * @param source the source
- *
- * @return the calculated region, or null if it cannot be determined
- */
- //???AWT
+ * @param image
+ * the image.
+ * @param destLocation
+ * the dest location.
+ * @param destSize
+ * the dest size.
+ * @param source
+ * the source.
+ * @return the calculated region, or null if it cannot be determined.
+ */
+ // ???AWT
/*
- MultiRectArea getObscuredRegion(Rectangle part) {
- if (!visible || parent == null || !parent.visible) {
- return null;
- }
- Rectangle r = new Rectangle(0, 0, w, h);
- if (part != null) {
- r = r.intersection(part);
- }
- if (r.isEmpty()) {
- return null;
- }
- r.translate(x, y);
- MultiRectArea ret = parent.getObscuredRegion(r);
- if (ret != null) {
- parent.addObscuredRegions(ret, this);
- ret.translate(-x, -y);
- ret.intersect(new Rectangle(0, 0, w, h));
- }
- return ret;
- }
- */
+ * MultiRectArea getObscuredRegion(Rectangle part) { if (!visible || parent
+ * == null || !parent.visible) { return null; } Rectangle r = new
+ * Rectangle(0, 0, w, h); if (part != null) { r = r.intersection(part); } if
+ * (r.isEmpty()) { return null; } r.translate(x, y); MultiRectArea ret =
+ * parent.getObscuredRegion(r); if (ret != null) {
+ * parent.addObscuredRegions(ret, this); ret.translate(-x, -y);
+ * ret.intersect(new Rectangle(0, 0, w, h)); } return ret; }
+ */
- //???AWT
+ // ???AWT
/*
- private void readObject(ObjectInputStream stream) throws IOException,
- ClassNotFoundException {
- stream.defaultReadObject();
- FieldsAccessor accessor = new FieldsAccessor(Component.class, this);
- accessor.set("toolkit", Toolkit.getDefaultToolkit()); //$NON-NLS-1$
- accessor.set("behaviour", createBehavior()); //$NON-NLS-1$
- accessor.set("componentLock", new Object()); // $NON-LOCK-1$ //$NON-NLS-1$
- }
- */
+ * private void readObject(ObjectInputStream stream) throws IOException,
+ * ClassNotFoundException { stream.defaultReadObject(); FieldsAccessor
+ * accessor = new FieldsAccessor(Component.class, this);
+ * accessor.set("toolkit", Toolkit.getDefaultToolkit()); //$NON-NLS-1$
+ * accessor.set("behaviour", createBehavior()); //$NON-NLS-1$
+ * accessor.set("componentLock", new Object()); // $NON-LOCK-1$
+ * //$NON-NLS-1$ }
+ */
final void onDrawImage(Image image, Point destLocation, Dimension destSize, Rectangle source) {
ImageParameters imageParams;
@@ -6272,33 +5883,37 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
}
}
- //???AWT
+ // ???AWT
/*
- private void invalidateRealParent() {
- Container realParent = getRealParent();
- if ((realParent != null) && realParent.isValid()) {
- realParent.invalidate();
- }
- }
- */
+ * private void invalidateRealParent() { Container realParent =
+ * getRealParent(); if ((realParent != null) && realParent.isValid()) {
+ * realParent.invalidate(); } }
+ */
/**
* The Class ImageParameters.
*/
private class ImageParameters {
-
- /** The drawing params. */
+
+ /**
+ * The drawing params.
+ */
private final LinkedList drawingParams = new LinkedList();
- /** The size. */
+ /**
+ * The size.
+ */
Dimension size = new Dimension(Component.this.w, Component.this.h);
/**
* Adds the drawing.
*
- * @param destLocation the dest location
- * @param destSize the dest size
- * @param source the source
+ * @param destLocation
+ * the dest location.
+ * @param destSize
+ * the dest size.
+ * @param source
+ * the source.
*/
void addDrawing(Point destLocation, Dimension destSize, Rectangle source) {
drawingParams.add(new DrawingParameters(destLocation, destSize, source));
@@ -6307,7 +5922,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* Drawing parameters iterator.
*
- * @return the iterator< drawing parameters>
+ * @return the iterator< drawing parameters>.
*/
Iterator drawingParametersIterator() {
return drawingParams.iterator();
@@ -6317,22 +5932,31 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
* The Class DrawingParameters.
*/
class DrawingParameters {
-
- /** The dest location. */
+
+ /**
+ * The dest location.
+ */
Point destLocation;
- /** The dest size. */
+ /**
+ * The dest size.
+ */
Dimension destSize;
- /** The source. */
+ /**
+ * The source.
+ */
Rectangle source;
/**
* Instantiates a new drawing parameters.
*
- * @param destLocation the dest location
- * @param destSize the dest size
- * @param source the source
+ * @param destLocation
+ * the dest location.
+ * @param destSize
+ * the dest size.
+ * @param source
+ * the source.
*/
DrawingParameters(Point destLocation, Dimension destSize, Rectangle source) {
this.destLocation = new Point(destLocation);
@@ -6353,44 +5977,32 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali
/**
* TextComponent support.
*
- * @param e the e
- *
- * @return true, if dispatch event to im
+ * @param e
+ * the e.
+ * @return true, if dispatch event to im.
*/
- //???AWT
+ // ???AWT
/*
- private TextKit textKit = null;
-
- TextKit getTextKit() {
- return textKit;
- }
-
- void setTextKit(TextKit kit) {
- textKit = kit;
- }
- */
+ * private TextKit textKit = null; TextKit getTextKit() { return textKit; }
+ * void setTextKit(TextKit kit) { textKit = kit; }
+ */
/**
- * TextField support
+ * TextField support.
*/
- //???AWT
+ // ???AWT
/*
- private TextFieldKit textFieldKit = null;
-
- TextFieldKit getTextFieldKit() {
- return textFieldKit;
- }
-
- void setTextFieldKit(TextFieldKit kit) {
- textFieldKit = kit;
- }
- */
+ * private TextFieldKit textFieldKit = null; TextFieldKit getTextFieldKit()
+ * { return textFieldKit; } void setTextFieldKit(TextFieldKit kit) {
+ * textFieldKit = kit; }
+ */
/**
- * Dispatches input & focus events to input method
- * context.
- * @param e event to pass to InputContext.dispatchEvent()
- * @return true if event was consumed by IM, false otherwise
+ * Dispatches input & focus events to input method context.
+ *
+ * @param e
+ * event to pass to InputContext.dispatchEvent().
+ * @return true if event was consumed by IM, false otherwise.
*/
private boolean dispatchEventToIM(AWTEvent e) {
InputContext ic = getInputContext();
diff --git a/awt/java/awt/ComponentBehavior.java b/awt/java/awt/ComponentBehavior.java
index 89c9999a622e21b7ca39bd51837e2e5d5a8e596a..f4e8ffbf204527ff04befe5c2404c3904f7fd822 100644
--- a/awt/java/awt/ComponentBehavior.java
+++ b/awt/java/awt/ComponentBehavior.java
@@ -24,7 +24,7 @@ import org.apache.harmony.awt.wtk.NativeWindow;
/**
* The interface of the helper object that encapsulates the difference
- * between lightweight and heavyweight components.
+ * between lightweight and heavyweight components.
*/
interface ComponentBehavior {
diff --git a/awt/java/awt/ComponentOrientation.java b/awt/java/awt/ComponentOrientation.java
index ddb118d592d41684d79615613b84d602d7ef6b3d..5acc11a341951e9303b2f605cc4ddbddc3edfd4b 100644
--- a/awt/java/awt/ComponentOrientation.java
+++ b/awt/java/awt/ComponentOrientation.java
@@ -18,44 +18,59 @@
* @author Michael Danilov, Dmitry A. Durnev
* @version $Revision$
*/
+
package java.awt;
import java.io.Serializable;
import java.util.*;
/**
- * The ComponentOrientation class specifies the language-sensitive orientation
- * of component's elements or text. It is used to reflect the differences in this
- * ordering between different writting systems. The ComponentOrientation class
- * indicates the orientation of the elements/text in the horizontal direction
- * ("left to right" or "right to left") and in the vertical direction
+ * The ComponentOrientation class specifies the language-sensitive orientation
+ * of component's elements or text. It is used to reflect the differences in
+ * this ordering between different writing systems. The ComponentOrientation
+ * class indicates the orientation of the elements/text in the horizontal
+ * direction ("left to right" or "right to left") and in the vertical direction
* ("top to bottom" or "bottom to top").
+ *
+ * @since Android 1.0
*/
public final class ComponentOrientation implements Serializable {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -4113291392143563828L;
- /**
+ /**
* The Constant LEFT_TO_RIGHT indicates that items run left to right.
*/
public static final ComponentOrientation LEFT_TO_RIGHT = new ComponentOrientation(true, true);
- /**
+ /**
* The Constant RIGHT_TO_LEFT indicates that items run right to left.
*/
public static final ComponentOrientation RIGHT_TO_LEFT = new ComponentOrientation(true, false);
- /** The Constant UNKNOWN indicates that a component's orientation is not set. */
+ /**
+ * The Constant UNKNOWN indicates that a component's orientation is not set.
+ */
public static final ComponentOrientation UNKNOWN = new ComponentOrientation(true, true);
- /** The Constant rlLangs. */
- private static final Set rlLangs = new HashSet(); //RIGHT_TO_LEFT languages
+ /**
+ * The Constant rlLangs.
+ */
+ private static final Set rlLangs = new HashSet(); // RIGHT_TO_LEFT
- /** The horizontal. */
+ // languages
+
+ /**
+ * The horizontal.
+ */
private final boolean horizontal;
- /** The left2right. */
+ /**
+ * The left2right.
+ */
private final boolean left2right;
static {
@@ -68,10 +83,9 @@ public final class ComponentOrientation implements Serializable {
/**
* Gets the orientation for the given ResourceBundle's localization.
*
- * @param bdl the ResourceBundle.
- *
+ * @param bdl
+ * the ResourceBundle.
* @return the ComponentOrientation.
- *
* @deprecated Use getOrientation(java.util.Locale) method.
*/
@Deprecated
@@ -79,12 +93,11 @@ public final class ComponentOrientation implements Serializable {
Object obj = null;
try {
obj = bdl.getObject("Orientation"); //$NON-NLS-1$
- }
- catch (MissingResourceException mre) {
+ } catch (MissingResourceException mre) {
obj = null;
}
if (obj instanceof ComponentOrientation) {
- return (ComponentOrientation) obj;
+ return (ComponentOrientation)obj;
}
Locale locale = bdl.getLocale();
if (locale == null) {
@@ -96,8 +109,8 @@ public final class ComponentOrientation implements Serializable {
/**
* Gets the orientation for the specified locale.
*
- * @param locale the specified Locale.
- *
+ * @param locale
+ * the specified Locale.
* @return the ComponentOrientation.
*/
public static ComponentOrientation getOrientation(Locale locale) {
@@ -108,8 +121,10 @@ public final class ComponentOrientation implements Serializable {
/**
* Instantiates a new component orientation.
*
- * @param hor whether the items should be arranged horizontally
- * @param l2r whether this orientation specifies a left-to-right flow
+ * @param hor
+ * whether the items should be arranged horizontally.
+ * @param l2r
+ * whether this orientation specifies a left-to-right flow.
*/
private ComponentOrientation(boolean hor, boolean l2r) {
horizontal = hor;
@@ -117,11 +132,10 @@ public final class ComponentOrientation implements Serializable {
}
/**
- * Returns true if the text of the of writing systems arranged
- * horizontally.
+ * Returns true if the text of the of writing systems arranged horizontally.
*
- * @return true, if the text is written horizontally, false
- * for a vertical arrangement.
+ * @return true, if the text is written horizontally, false for a vertical
+ * arrangement.
*/
public boolean isHorizontal() {
return horizontal;
@@ -130,8 +144,8 @@ public final class ComponentOrientation implements Serializable {
/**
* Returns true if the text is arranged from left to right.
*
- * @return true, for writing systems written from left to right;
- * false for right-to-left.
+ * @return true, for writing systems written from left to right; false for
+ * right-to-left.
*/
public boolean isLeftToRight() {
return left2right;
diff --git a/awt/java/awt/Composite.java b/awt/java/awt/Composite.java
index 8e5b90a676b1faa36a35c9d97e5ad05c3c84d821..d1730fef4a677e97fdad492520be636266ed61fd 100644
--- a/awt/java/awt/Composite.java
+++ b/awt/java/awt/Composite.java
@@ -18,30 +18,34 @@
* @author Igor V. Stolyarov
* @version $Revision$
*/
+
package java.awt;
import java.awt.image.ColorModel;
/**
- * The Composite interface allows the methods to compose a draw primitive
- * on the graphics area. The classes implementing this interface provides
- * the rules and a method to create the context for a particular operation.
+ * The Composite interface allows the methods to compose a draw primitive on the
+ * graphics area. The classes implementing this interface provides the rules and
+ * a method to create the context for a particular operation.
+ *
+ * @since Android 1.0
*/
public interface Composite {
/**
- * Creates a CompositeContext which defines the encapsulated and
- * optimized environment for a compositing operation. Several contexts
- * can exist for a single Composite object.
- *
- * @param srcColorModel the source's ColorModel.
- * @param dstColorModel the destination's ColorModel.
- * @param hints the RenderingHints.
+ * Creates a CompositeContext which defines the encapsulated and optimized
+ * environment for a compositing operation. Several contexts can exist for a
+ * single Composite object.
*
+ * @param srcColorModel
+ * the source's ColorModel.
+ * @param dstColorModel
+ * the destination's ColorModel.
+ * @param hints
+ * the RenderingHints.
* @return the CompositeContext object.
*/
- public CompositeContext createContext(ColorModel srcColorModel,
- ColorModel dstColorModel, RenderingHints hints);
+ public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel,
+ RenderingHints hints);
}
-
diff --git a/awt/java/awt/CompositeContext.java b/awt/java/awt/CompositeContext.java
index c6760325b6ad61a076c1ea26bd0a149f651b916a..795640d429a4c717a57a63556a55fadf83e46b02 100644
--- a/awt/java/awt/CompositeContext.java
+++ b/awt/java/awt/CompositeContext.java
@@ -18,25 +18,31 @@
* @author Igor V. Stolyarov
* @version $Revision$
*/
+
package java.awt;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
/**
- * The CompositeContext interface specifies the encapsulated and optimized
- * environment for a compositing operation.
+ * The CompositeContext interface specifies the encapsulated and optimized
+ * environment for a compositing operation.
+ *
+ * @since Android 1.0
*/
public interface CompositeContext {
/**
- * Composes the two source Raster objects and places the result in the
- * destination WritableRaster.
+ * Composes the two source Raster objects and places the result in the
+ * destination WritableRaster.
*
- * @param src the source Raster.
- * @param dstIn the destination Raster.
- * @param dstOut the WritableRaster object where the result of
- * composing operation is stored.
+ * @param src
+ * the source Raster.
+ * @param dstIn
+ * the destination Raster.
+ * @param dstOut
+ * the WritableRaster object where the result of composing
+ * operation is stored.
*/
public void compose(Raster src, Raster dstIn, WritableRaster dstOut);
@@ -46,4 +52,3 @@ public interface CompositeContext {
public void dispose();
}
-
diff --git a/awt/java/awt/Cursor.java b/awt/java/awt/Cursor.java
index 625686c90ab5e57ac5a66e78af157f342d2754b8..0a0cc8498722bb205485ed89f2317712fe44715d 100644
--- a/awt/java/awt/Cursor.java
+++ b/awt/java/awt/Cursor.java
@@ -18,6 +18,7 @@
* @author Dmitry A. Durnev
* @version $Revision$
*/
+
package java.awt;
import java.io.File;
@@ -35,61 +36,99 @@ import org.apache.harmony.awt.wtk.NativeCursor;
/**
* The Cursor class represents the bitmap of the mouse cursor.
+ *
+ * @since Android 1.0
*/
public class Cursor implements Serializable {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = 8028237497568985504L;
-
- /** The Constant DEFAULT_CURSOR indicates the default cursor type. */
+
+ /**
+ * The Constant DEFAULT_CURSOR indicates the default cursor type.
+ */
public static final int DEFAULT_CURSOR = 0;
- /** The Constant CROSSHAIR_CURSOR cursor type. */
+ /**
+ * The Constant CROSSHAIR_CURSOR cursor type.
+ */
public static final int CROSSHAIR_CURSOR = 1;
- /** The Constant TEXT_CURSOR cursor type. */
+ /**
+ * The Constant TEXT_CURSOR cursor type.
+ */
public static final int TEXT_CURSOR = 2;
- /** The Constant WAIT_CURSOR cursor type. */
+ /**
+ * The Constant WAIT_CURSOR cursor type.
+ */
public static final int WAIT_CURSOR = 3;
- /** The Constant SW_RESIZE_CURSOR cursor type. */
+ /**
+ * The Constant SW_RESIZE_CURSOR cursor type.
+ */
public static final int SW_RESIZE_CURSOR = 4;
- /** The Constant SE_RESIZE_CURSOR cursor type. */
+ /**
+ * The Constant SE_RESIZE_CURSOR cursor type.
+ */
public static final int SE_RESIZE_CURSOR = 5;
- /** The Constant NW_RESIZE_CURSOR cursor type. */
+ /**
+ * The Constant NW_RESIZE_CURSOR cursor type.
+ */
public static final int NW_RESIZE_CURSOR = 6;
- /** The Constant NE_RESIZE_CURSOR cursor type. */
+ /**
+ * The Constant NE_RESIZE_CURSOR cursor type.
+ */
public static final int NE_RESIZE_CURSOR = 7;
- /** The Constant N_RESIZE_CURSOR cursor type. */
+ /**
+ * The Constant N_RESIZE_CURSOR cursor type.
+ */
public static final int N_RESIZE_CURSOR = 8;
- /** The Constant S_RESIZE_CURSOR cursor type. */
+ /**
+ * The Constant S_RESIZE_CURSOR cursor type.
+ */
public static final int S_RESIZE_CURSOR = 9;
- /** The Constant W_RESIZE_CURSOR cursor type. */
+ /**
+ * The Constant W_RESIZE_CURSOR cursor type.
+ */
public static final int W_RESIZE_CURSOR = 10;
- /** The Constant E_RESIZE_CURSOR cursor type. */
+ /**
+ * The Constant E_RESIZE_CURSOR cursor type.
+ */
public static final int E_RESIZE_CURSOR = 11;
- /** The Constant HAND_CURSOR cursor type. */
+ /**
+ * The Constant HAND_CURSOR cursor type.
+ */
public static final int HAND_CURSOR = 12;
- /** The Constant MOVE_CURSOR cursor type. */
+ /**
+ * The Constant MOVE_CURSOR cursor type.
+ */
public static final int MOVE_CURSOR = 13;
- /** A mapping from names to system custom cursors. */
+ /**
+ * A mapping from names to system custom cursors.
+ */
static Map systemCustomCursors;
-
- /** The cursor props. */
+
+ /**
+ * The cursor props.
+ */
static Properties cursorProps;
- /** The Constant predefinedNames. */
+ /**
+ * The Constant predefinedNames.
+ */
static final String[] predefinedNames = {
"Default", "Crosshair", "Text", "Wait", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"Southwest Resize", "Southeast Resize", //$NON-NLS-1$ //$NON-NLS-2$
@@ -99,41 +138,52 @@ public class Cursor implements Serializable {
};
- /** The predefined set of cursors. */
+ /**
+ * The predefined set of cursors.
+ */
protected static Cursor[] predefined = {
- new Cursor(DEFAULT_CURSOR), null, null, null,
- null, null, null, null,
- null, null, null, null,
- null, null
+ new Cursor(DEFAULT_CURSOR), null, null, null, null, null, null, null, null, null, null,
+ null, null, null
};
- /** The Constant CUSTOM_CURSOR is associated with all custom cursor types.
+ /**
+ * The Constant CUSTOM_CURSOR is associated with all custom cursor types.
* (Those which are not predefined)
*/
public static final int CUSTOM_CURSOR = -1;
- /** The name of the cursor. */
+ /**
+ * The name of the cursor.
+ */
protected String name;
- /** The type of the cursor, chosen from the list of cursor type constants. */
+ /**
+ * The type of the cursor, chosen from the list of cursor type constants.
+ */
private final int type;
-
- /** The native cursor. */
+
+ /**
+ * The native cursor.
+ */
private transient NativeCursor nativeCursor;
-
- /** The exact point on the cursor image that indicates which point
- * the cursor is selecting (pointing to). The coordinates are given
- * with respect the origin of the Image (its upper left corner).
+
+ /**
+ * The exact point on the cursor image that indicates which point the cursor
+ * is selecting (pointing to). The coordinates are given with respect the
+ * origin of the Image (its upper left corner).
*/
private Point hotSpot;
-
- /** The image to draw on the screen representing the cursor. */
+
+ /**
+ * The image to draw on the screen representing the cursor.
+ */
private Image image;
/**
* Instantiates a new cursor with the specified name.
*
- * @param name the name of cursor.
+ * @param name
+ * the name of cursor.
*/
protected Cursor(String name) {
this(name, null, new Point());
@@ -142,7 +192,8 @@ public class Cursor implements Serializable {
/**
* Instantiates a new cursor of the specified type.
*
- * @param type the type of cursor.
+ * @param type
+ * the type of cursor.
*/
public Cursor(int type) {
checkType(type);
@@ -155,9 +206,12 @@ public class Cursor implements Serializable {
/**
* Instantiates a new cursor.
*
- * @param name the name
- * @param img the img
- * @param hotSpot the hot spot
+ * @param name
+ * the name.
+ * @param img
+ * the img.
+ * @param hotSpot
+ * the hot spot.
*/
Cursor(String name, Image img, Point hotSpot) {
this.name = name;
@@ -167,10 +221,11 @@ public class Cursor implements Serializable {
}
/**
- * Finalize method overrided finalize method from Object class.
+ * Finalize method overrides the finalize method from Object class.
*
- * @throws Throwable if the native cursor is not null and throws
- * a throwable when destroyed.
+ * @throws Throwable
+ * if the native cursor is not null and throws a Throwable when
+ * destroyed.
*/
@Override
protected void finalize() throws Throwable {
@@ -201,7 +256,7 @@ public class Cursor implements Serializable {
/**
* Gets the cursor type.
*
- * @return the cursor type
+ * @return the cursor type.
*/
public int getType() {
return type;
@@ -210,8 +265,8 @@ public class Cursor implements Serializable {
/**
* Gets the predefined cursor with the specified type.
*
- * @param type the type of cursor.
- *
+ * @param type
+ * the type of cursor.
* @return the predefined cursor with the specified type.
*/
public static Cursor getPredefinedCursor(int type) {
@@ -236,33 +291,33 @@ public class Cursor implements Serializable {
/**
* Gets the specified system custom cursor.
*
- * @param name the name of the desired system cursor.
- *
+ * @param name
+ * the name of the desired system cursor.
* @return the specific system cursor with the specified name.
- *
- * @throws AWTException if the desired cursor has malformed data
- * such as an incorrectly defined hot spot.
- * @throws HeadlessException if the isHeadless method of the GraphicsEnvironment
- * returns true.
+ * @throws AWTException
+ * if the desired cursor has malformed data such as an
+ * incorrectly defined hot spot.
+ * @throws HeadlessException
+ * if the isHeadless method of the GraphicsEnvironment returns
+ * true.
*/
- public static Cursor getSystemCustomCursor(String name)
- throws AWTException, HeadlessException {
+ public static Cursor getSystemCustomCursor(String name) throws AWTException, HeadlessException {
Toolkit.checkHeadless();
return getSystemCustomCursorFromMap(name);
}
/**
- * Gets the specified system custom cursor from the map of system custom cursors.
+ * Gets the specified system custom cursor from the map of system custom
+ * cursors.
*
- * @param name the name of the desired cursor.
- *
- * @return the desired system custom cursor from the
- * map of system custom cursors.
- *
- * @throws AWTException the AWT exception
+ * @param name
+ * the name of the desired cursor.
+ * @return the desired system custom cursor from the map of system custom
+ * cursors.
+ * @throws AWTException
+ * the AWT exception.
*/
- private static Cursor getSystemCustomCursorFromMap (String name)
- throws AWTException {
+ private static Cursor getSystemCustomCursorFromMap(String name) throws AWTException {
loadCursorProps();
if (systemCustomCursors == null) {
systemCustomCursors = new HashMap();
@@ -284,8 +339,7 @@ public class Cursor implements Serializable {
int x, y;
try {
x = new Integer(hotSpotStr.substring(0, idx)).intValue();
- y = new Integer(hotSpotStr.substring(idx + 1,
- hotSpotStr.length())).intValue();
+ y = new Integer(hotSpotStr.substring(idx + 1, hotSpotStr.length())).intValue();
} catch (NumberFormatException nfe) {
throw new AWTException(exMsg);
}
@@ -299,7 +353,8 @@ public class Cursor implements Serializable {
/**
* Load cursor props.
*
- * @throws AWTException the AWT exception
+ * @throws AWTException
+ * the AWT exception.
*/
private static void loadCursorProps() throws AWTException {
if (cursorProps != null) {
@@ -308,18 +363,18 @@ public class Cursor implements Serializable {
String sep = File.separator;
String cursorsDir = "lib" + sep + "images" + sep + "cursors"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String cursorsAbsDir = System.getProperty("java.home") + sep + //$NON-NLS-1$
- cursorsDir;
+ cursorsDir;
String cursorPropsFileName = "cursors.properties"; //$NON-NLS-1$
- String cursorPropsFullFileName = (cursorsAbsDir + sep +
- cursorPropsFileName);
+ String cursorPropsFullFileName = (cursorsAbsDir + sep + cursorPropsFileName);
cursorProps = new Properties();
try {
- cursorProps.load(new FileInputStream(new File(
- cursorPropsFullFileName)));
+ cursorProps.load(new FileInputStream(new File(cursorPropsFullFileName)));
} catch (FileNotFoundException e) {
// awt.142=Exception: class {0} {1} occurred while loading: {2}
throw new AWTException(Messages.getString("awt.142",//$NON-NLS-1$
- new Object[]{e.getClass(), e.getMessage(), cursorPropsFullFileName}));
+ new Object[] {
+ e.getClass(), e.getMessage(), cursorPropsFullFileName
+ }));
} catch (IOException e) {
throw new AWTException(e.getMessage());
}
@@ -329,7 +384,8 @@ public class Cursor implements Serializable {
/**
* Check type.
*
- * @param type the type
+ * @param type
+ * the type.
*/
static void checkType(int type) {
// can't use predefined array here because it may not have been
@@ -344,7 +400,7 @@ public class Cursor implements Serializable {
/**
* Gets the native cursor.
*
- * @return the native cursor
+ * @return the native cursor.
*/
NativeCursor getNativeCursor() {
if (nativeCursor != null) {
@@ -354,8 +410,7 @@ public class Cursor implements Serializable {
if (type != CUSTOM_CURSOR) {
nativeCursor = toolkit.createNativeCursor(type);
} else {
- nativeCursor = toolkit.createCustomNativeCursor(image, hotSpot,
- name);
+ nativeCursor = toolkit.createCustomNativeCursor(image, hotSpot, name);
}
return nativeCursor;
}
@@ -363,10 +418,10 @@ public class Cursor implements Serializable {
/**
* Sets the native cursor.
*
- * @param nativeCursor the new native cursor
+ * @param nativeCursor
+ * the new native cursor.
*/
void setNativeCursor(NativeCursor nativeCursor) {
this.nativeCursor = nativeCursor;
}
}
-
diff --git a/awt/java/awt/Dimension.java b/awt/java/awt/Dimension.java
index 8137846018d2dba5a1d05cb8563b691f172424f1..6777962e7a37a739e4d0c4bb0be0b7a15595d79e 100644
--- a/awt/java/awt/Dimension.java
+++ b/awt/java/awt/Dimension.java
@@ -18,6 +18,7 @@
* @author Denis M. Kishenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.geom.Dimension2D;
@@ -26,26 +27,36 @@ import java.io.Serializable;
import org.apache.harmony.misc.HashCode;
/**
- * The Dimension represents the size (width and height) of a component.
- * The width and height values can be negative, but in that case the
- * behavior of some methods is unexpected.
+ * The Dimension represents the size (width and height) of a component. The
+ * width and height values can be negative, but in that case the behavior of
+ * some methods is unexpected.
+ *
+ * @since Android 1.0
*/
public class Dimension extends Dimension2D implements Serializable {
- /** The Constant serialVersionUID. */
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = 4723952579491349524L;
- /** The width dimension. */
+ /**
+ * The width dimension.
+ */
public int width;
-
- /** The height dimension. */
+
+ /**
+ * The height dimension.
+ */
public int height;
/**
- * Instantiates a new Dimension with the same data as the specified Dimension.
+ * Instantiates a new Dimension with the same data as the specified
+ * Dimension.
*
- * @param d the Dimension to copy the data from when creating the
- * new Dimension object.
+ * @param d
+ * the Dimension to copy the data from when creating the new
+ * Dimension object.
*/
public Dimension(Dimension d) {
this(d.width, d.height);
@@ -61,8 +72,10 @@ public class Dimension extends Dimension2D implements Serializable {
/**
* Instantiates a new Dimension with the specified width and height.
*
- * @param width the width of the new Dimension.
- * @param height the height of the new Dimension.
+ * @param width
+ * the width of the new Dimension.
+ * @param height
+ * the height of the new Dimension.
*/
public Dimension(int width, int height) {
setSize(width, height);
@@ -84,10 +97,10 @@ public class Dimension extends Dimension2D implements Serializable {
/**
* Compares this Dimension object with the specified object.
*
- * @param obj the Object to be compared.
- *
- * @return true, if the specified Object is a Dimension with
- * the same width and height data as this Dimension.
+ * @param obj
+ * the Object to be compared.
+ * @return true, if the specified Object is a Dimension with the same width
+ * and height data as this Dimension.
*/
@Override
public boolean equals(Object obj) {
@@ -108,16 +121,20 @@ public class Dimension extends Dimension2D implements Serializable {
*/
@Override
public String toString() {
- // The output format based on 1.5 release behaviour. It could be obtained in the following way
+ // The output format based on 1.5 release behaviour. It could be
+ // obtained in the following way
// System.out.println(new Dimension().toString())
return getClass().getName() + "[width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/**
- * Sets the size of this Dimension object with the specified width and height.
+ * Sets the size of this Dimension object with the specified width and
+ * height.
*
- * @param width the width of the Dimension.
- * @param height the height of the Dimension.
+ * @param width
+ * the width of the Dimension.
+ * @param height
+ * the height of the Dimension.
*/
public void setSize(int width, int height) {
this.width = width;
@@ -125,22 +142,24 @@ public class Dimension extends Dimension2D implements Serializable {
}
/**
- * Sets the size of this Dimension object by copying the
- * data from the specified Dimension object.
+ * Sets the size of this Dimension object by copying the data from the
+ * specified Dimension object.
*
- * @param d the Dimension that gives the new size values.
+ * @param d
+ * the Dimension that gives the new size values.
*/
public void setSize(Dimension d) {
setSize(d.width, d.height);
}
/**
- * Sets the size of this Dimension object with the specified double width
+ * Sets the size of this Dimension object with the specified double width
* and height.
*
- * @param width the width of the Dimension.
- * @param height the height of the Dimension.
- *
+ * @param width
+ * the width of the Dimension.
+ * @param height
+ * the height of the Dimension.
* @see java.awt.geom.Dimension2D#setSize(double, double)
*/
@Override
@@ -161,7 +180,6 @@ public class Dimension extends Dimension2D implements Serializable {
* Gets the height of the Dimension.
*
* @return the height of the Dimension.
- *
* @see java.awt.geom.Dimension2D#getHeight()
*/
@Override
@@ -173,7 +191,6 @@ public class Dimension extends Dimension2D implements Serializable {
* Gets the width of the Dimension.
*
* @return the width of the Dimension.
- *
* @see java.awt.geom.Dimension2D#getWidth()
*/
@Override
@@ -182,4 +199,3 @@ public class Dimension extends Dimension2D implements Serializable {
}
}
-
diff --git a/awt/java/awt/DisplayMode.java b/awt/java/awt/DisplayMode.java
index 082c7b8aeaa580663272d5712602e79f55bd36d4..8021010198f4591804e9aedd684ce7aadf717272 100644
--- a/awt/java/awt/DisplayMode.java
+++ b/awt/java/awt/DisplayMode.java
@@ -18,41 +18,60 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
/**
- * The DisplayMode class containes the bit depth, height, width and
- * refresh rate of a GraphicsDevice.
+ * The DisplayMode class contains the bit depth, height, width and refresh rate
+ * of a GraphicsDevice.
+ *
+ * @since Android 1.0
*/
public final class DisplayMode {
-
- /** The width. */
+
+ /**
+ * The width.
+ */
private final int width;
- /** The height. */
+ /**
+ * The height.
+ */
private final int height;
- /** The bit depth. */
+ /**
+ * The bit depth.
+ */
private final int bitDepth;
- /** The refresh rate. */
+ /**
+ * The refresh rate.
+ */
private final int refreshRate;
- /** The Constant Value BIT_DEPTH_MULTI indicates the bit depth */
+ /**
+ * The Constant Value BIT_DEPTH_MULTI indicates the bit depth
+ */
public static final int BIT_DEPTH_MULTI = -1;
- /** The Constant REFRESH_RATE_UNKNOWN indicates the refresh rate. */
+ /**
+ * The Constant REFRESH_RATE_UNKNOWN indicates the refresh rate.
+ */
public static final int REFRESH_RATE_UNKNOWN = 0;
- /**
- * Creates a new DisplayMode object with the specified parameters.
- *
- * @param width the width of the display.
- * @param height the height of the display.
- * @param bitDepth the bit depth of the display.
- * @param refreshRate the refresh rate of the display.
- */
+ /**
+ * Creates a new DisplayMode object with the specified parameters.
+ *
+ * @param width
+ * the width of the display.
+ * @param height
+ * the height of the display.
+ * @param bitDepth
+ * the bit depth of the display.
+ * @param refreshRate
+ * the refresh rate of the display.
+ */
public DisplayMode(int width, int height, int bitDepth, int refreshRate) {
this.width = width;
@@ -61,15 +80,14 @@ public final class DisplayMode {
this.refreshRate = refreshRate;
}
-
- /**
- * Compares if this DisplayMode is equal to the specified object or not.
- *
- * @param dm the Object to be compared.
- *
- * @return true, if the specified object is a DisplayMode with the same
- * data values as this DisplayMode, false otherwise.
- */
+ /**
+ * Compares if this DisplayMode is equal to the specified object or not.
+ *
+ * @param dm
+ * the Object to be compared.
+ * @return true, if the specified object is a DisplayMode with the same data
+ * values as this DisplayMode, false otherwise.
+ */
@Override
public boolean equals(Object dm) {
@@ -80,13 +98,13 @@ public final class DisplayMode {
}
/**
- * Compares if this DisplayMode is equal to the specified DisplayMode object
- * or not.
- *
- * @param dm the DisplayMode to be compared.
- *
- * @return true, if all of the data values of this DisplayMode are equal
- * to the values of the specified DisplayMode object, false otherwise.
+ * Compares if this DisplayMode is equal to the specified DisplayMode object
+ * or not.
+ *
+ * @param dm
+ * the DisplayMode to be compared.
+ * @return true, if all of the data values of this DisplayMode are equal to
+ * the values of the specified DisplayMode object, false otherwise.
*/
public boolean equals(DisplayMode dm) {
if (dm == null) {
@@ -108,8 +126,8 @@ public final class DisplayMode {
}
/**
- * Gets the bit depth of the DisplayMode, returns BIT_DEPTH_MULTI value
- * if multiple bit depths are supported in this display mode.
+ * Gets the bit depth of the DisplayMode, returns BIT_DEPTH_MULTI value if
+ * multiple bit depths are supported in this display mode.
*
* @return the bit depth of the DisplayMode.
*/
diff --git a/awt/java/awt/Event.java b/awt/java/awt/Event.java
index f074258db7f48cf251b8297f40fc8f0a6048f5ed..226a61fffed33c8fc4873f8d5b05feeb8294a18f 100644
--- a/awt/java/awt/Event.java
+++ b/awt/java/awt/Event.java
@@ -18,224 +18,293 @@
* @author Dmitry A. Durnev
* @version $Revision$
*/
+
package java.awt;
import java.io.Serializable;
/**
- * The Event Class is obsolete and has been replaced by AWTEvent class.
+ * The Event class is obsolete and has been replaced by AWTEvent class.
*
+ * @since Android 1.0
*/
public class Event implements Serializable {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = 5488922509400504703L;
-
- /**
- * The Constant SHIFT_MASK indicates that the Shift key is down when
- * the event occurred.
+
+ /**
+ * The Constant SHIFT_MASK indicates that the Shift key is down when the
+ * event occurred.
*/
public static final int SHIFT_MASK = 1;
- /**
- * The Constant CTRL_MASK indicates that the Control key is down when
- * the event occurred.
+ /**
+ * The Constant CTRL_MASK indicates that the Control key is down when the
+ * event occurred.
*/
public static final int CTRL_MASK = 2;
- /** The Constant META_MASK indicates that the Meta key is down when t
- * he event occurred (or the right mouse button). */
+ /**
+ * The Constant META_MASK indicates that the Meta key is down when t he
+ * event occurred (or the right mouse button).
+ */
public static final int META_MASK = 4;
- /**
- * The Constant ALT_MASK indicates that the Alt key is down when
- * the event occurred (or the middle mouse button).
+ /**
+ * The Constant ALT_MASK indicates that the Alt key is down when the event
+ * occurred (or the middle mouse button).
*/
public static final int ALT_MASK = 8;
- /** The Constant HOME indicates Home key. */
+ /**
+ * The Constant HOME indicates Home key.
+ */
public static final int HOME = 1000;
- /** The Constant END indicates End key. */
+ /**
+ * The Constant END indicates End key.
+ */
public static final int END = 1001;
- /** The Constant PGUP indicates Page Up key. */
+ /**
+ * The Constant PGUP indicates Page Up key.
+ */
public static final int PGUP = 1002;
- /** The Constant PGDN indicates Page Down key. */
+ /**
+ * The Constant PGDN indicates Page Down key.
+ */
public static final int PGDN = 1003;
- /** The Constant UP indicates Up key. */
+ /**
+ * The Constant UP indicates Up key.
+ */
public static final int UP = 1004;
- /** The Constant DOWN indicates Down key. */
+ /**
+ * The Constant DOWN indicates Down key.
+ */
public static final int DOWN = 1005;
- /** The Constant LEFT indicates Left key. */
+ /**
+ * The Constant LEFT indicates Left key.
+ */
public static final int LEFT = 1006;
- /** The Constant RIGHT indicates Right key. */
+ /**
+ * The Constant RIGHT indicates Right key.
+ */
public static final int RIGHT = 1007;
- /** The Constant F1 indicates F1 key. */
+ /**
+ * The Constant F1 indicates F1 key.
+ */
public static final int F1 = 1008;
- /** The Constant F2 indicates F2 key. */
+ /**
+ * The Constant F2 indicates F2 key.
+ */
public static final int F2 = 1009;
- /** The Constant F3 indicates F3 key. */
+ /**
+ * The Constant F3 indicates F3 key.
+ */
public static final int F3 = 1010;
- /** The Constant F4 indicates F4 key. */
+ /**
+ * The Constant F4 indicates F4 key.
+ */
public static final int F4 = 1011;
- /** The Constant F5 indicates F5 key. */
+ /**
+ * The Constant F5 indicates F5 key.
+ */
public static final int F5 = 1012;
- /** The Constant F6 indicates F6 key. */
+ /**
+ * The Constant F6 indicates F6 key.
+ */
public static final int F6 = 1013;
- /** The Constant F7 indicates F7 key. */
+ /**
+ * The Constant F7 indicates F7 key.
+ */
public static final int F7 = 1014;
- /** The Constant F8 indicates F8 key. */
+ /**
+ * The Constant F8 indicates F8 key.
+ */
public static final int F8 = 1015;
- /** The Constant F9 indicates F9 key. */
+ /**
+ * The Constant F9 indicates F9 key.
+ */
public static final int F9 = 1016;
- /** The Constant F10 indicates F10 key. */
+ /**
+ * The Constant F10 indicates F10 key.
+ */
public static final int F10 = 1017;
- /** The Constant F11 indicates F11 key. */
+ /**
+ * The Constant F11 indicates F11 key.
+ */
public static final int F11 = 1018;
- /** The Constant F12 indicates F12 key. */
+ /**
+ * The Constant F12 indicates F12 key.
+ */
public static final int F12 = 1019;
- /** The Constant PRINT_SCREEN indicates Print Screen key. */
+ /**
+ * The Constant PRINT_SCREEN indicates Print Screen key.
+ */
public static final int PRINT_SCREEN = 1020;
- /** The Constant SCROLL_LOCK indicates Scroll Lock key. */
+ /**
+ * The Constant SCROLL_LOCK indicates Scroll Lock key.
+ */
public static final int SCROLL_LOCK = 1021;
- /** The Constant CAPS_LOCK indicates Caps Lock key. */
+ /**
+ * The Constant CAPS_LOCK indicates Caps Lock key.
+ */
public static final int CAPS_LOCK = 1022;
- /** The Constant NUM_LOCK indicates Num Lock key. */
+ /**
+ * The Constant NUM_LOCK indicates Num Lock key.
+ */
public static final int NUM_LOCK = 1023;
- /** The Constant PAUSE indicates Pause key. */
+ /**
+ * The Constant PAUSE indicates Pause key.
+ */
public static final int PAUSE = 1024;
- /** The Constant INSERT indicates Insert key. */
+ /**
+ * The Constant INSERT indicates Insert key.
+ */
public static final int INSERT = 1025;
- /** The Constant ENTER indicates Enter key. */
+ /**
+ * The Constant ENTER indicates Enter key.
+ */
public static final int ENTER = 10;
- /** The Constant BACK_SPACE indicates Back Space key. */
+ /**
+ * The Constant BACK_SPACE indicates Back Space key.
+ */
public static final int BACK_SPACE = 8;
- /** The Constant TAB indicates TAb key. */
+ /**
+ * The Constant TAB indicates TAb key.
+ */
public static final int TAB = 9;
- /** The Constant ESCAPE indicates Escape key. */
+ /**
+ * The Constant ESCAPE indicates Escape key.
+ */
public static final int ESCAPE = 27;
- /** The Constant DELETE indicates Delete key. */
+ /**
+ * The Constant DELETE indicates Delete key.
+ */
public static final int DELETE = 127;
- /**
- * The Constant WINDOW_DESTROY indicates an event when the user has asked the
- * window manager to kill the window.
+ /**
+ * The Constant WINDOW_DESTROY indicates an event when the user has asked
+ * the window manager to kill the window.
*/
public static final int WINDOW_DESTROY = 201;
- /**
+ /**
* The Constant WINDOW_EXPOSE indicates an event when the user has asked the
* window manager to expose the window.
*/
public static final int WINDOW_EXPOSE = 202;
- /**
- * The Constant WINDOW_ICONIFY indicates an event when the user has asked the
- * window manager to inconify the window.
+ /**
+ * The Constant WINDOW_ICONIFY indicates an event when the user has asked
+ * the window manager to iconify the window.
*/
public static final int WINDOW_ICONIFY = 203;
- /**
- * The Constant WINDOW_DEICONIFY indicates an event when the user has asked the
- * window manager to deinconify the window.
+ /**
+ * The Constant WINDOW_DEICONIFY indicates an event when the user has asked
+ * the window manager to deiconify the window.
*/
public static final int WINDOW_DEICONIFY = 204;
- /**
+ /**
* The Constant WINDOW_MOVED indicates an event when the user has asked the
- * window manager to move the window.
+ * window manager to move the window.
*/
public static final int WINDOW_MOVED = 205;
- /**
- * The Constant KEY_PRESS indicates an event when the user presses
- * a normal key.
+ /**
+ * The Constant KEY_PRESS indicates an event when the user presses a normal
+ * key.
*/
public static final int KEY_PRESS = 401;
- /**
- * The Constant KEY_RELEASE indicates an event when the user releases
- * a normal key.
+ /**
+ * The Constant KEY_RELEASE indicates an event when the user releases a
+ * normal key.
*/
public static final int KEY_RELEASE = 402;
- /**
- * The Constant KEY_ACTION indicates an event when the user pressed
- * a non-ASCII action key.
+ /**
+ * The Constant KEY_ACTION indicates an event when the user pressed a
+ * non-ASCII action key.
*/
public static final int KEY_ACTION = 403;
/**
- * The Constant KEY_ACTION_RELEASE indicates an event when the user released
- * a non-ASCII action key.
+ * The Constant KEY_ACTION_RELEASE indicates an event when the user released
+ * a non-ASCII action key.
*/
public static final int KEY_ACTION_RELEASE = 404;
- /**
- * The Constant MOUSE_DOWN indicates an event when the user has pressed
- * the mouse button.
+ /**
+ * The Constant MOUSE_DOWN indicates an event when the user has pressed the
+ * mouse button.
*/
public static final int MOUSE_DOWN = 501;
- /**
- * The Constant MOUSE_UP indicates an event when the user has released
- * the mouse button.
+ /**
+ * The Constant MOUSE_UP indicates an event when the user has released the
+ * mouse button.
*/
public static final int MOUSE_UP = 502;
- /**
- * The Constant MOUSE_MOVE indicates an event when the user has moved
- * the mouse with no button pressed.
+ /**
+ * The Constant MOUSE_MOVE indicates an event when the user has moved the
+ * mouse with no button pressed.
*/
public static final int MOUSE_MOVE = 503;
- /**
- * The Constant MOUSE_ENTER indicates an event when the mouse
- * has entered a component.
+ /**
+ * The Constant MOUSE_ENTER indicates an event when the mouse has entered a
+ * component.
*/
public static final int MOUSE_ENTER = 504;
- /**
- * The Constant MOUSE_EXIT indicates an event when the mouse
- * has exited a component.
+ /**
+ * The Constant MOUSE_EXIT indicates an event when the mouse has exited a
+ * component.
*/
public static final int MOUSE_EXIT = 505;
- /** The Constant MOUSE_DRAG indicates an event when the user
- * has moved a mouse with the pressed button.
+ /**
+ * The Constant MOUSE_DRAG indicates an event when the user has moved a
+ * mouse with the pressed button.
*/
public static final int MOUSE_DRAG = 506;
- /**
+ /**
* The Constant SCROLL_LINE_UP indicates an event when the user has
* activated line-up area of scrollbar.
*/
@@ -243,101 +312,136 @@ public class Event implements Serializable {
/**
* The Constant SCROLL_LINE_DOWN indicates an event when the user has
- * activated line-down area of scrollbar.
+ * activated line-down area of scrollbar.
*/
public static final int SCROLL_LINE_DOWN = 602;
/**
* The Constant SCROLL_PAGE_UP indicates an event when the user has
- * activated page up area of scrollbar.
+ * activated page up area of scrollbar.
*/
public static final int SCROLL_PAGE_UP = 603;
/**
* The Constant SCROLL_PAGE_DOWN indicates an event when the user has
- * activated page down area of scrollbar.
+ * activated page down area of scrollbar.
*/
public static final int SCROLL_PAGE_DOWN = 604;
/**
- * The Constant SCROLL_ABSOLUTE indicates an event when the user
- * has moved the bubble in a scroll bar.
+ * The Constant SCROLL_ABSOLUTE indicates an event when the user has moved
+ * the bubble in a scroll bar.
*/
public static final int SCROLL_ABSOLUTE = 605;
- /** The Constant SCROLL_BEGIN indicates a scroll begin event. */
+ /**
+ * The Constant SCROLL_BEGIN indicates a scroll begin event.
+ */
public static final int SCROLL_BEGIN = 606;
- /** The Constant SCROLL_END indicates a scroll end event. */
+ /**
+ * The Constant SCROLL_END indicates a scroll end event.
+ */
public static final int SCROLL_END = 607;
- /**
- * The Constant LIST_SELECT indicates that an item in a list
- * has been selected.
+ /**
+ * The Constant LIST_SELECT indicates that an item in a list has been
+ * selected.
*/
public static final int LIST_SELECT = 701;
- /**
- * The Constant LIST_DESELECT indicates that an item in a list
- * has been deselected.
+ /**
+ * The Constant LIST_DESELECT indicates that an item in a list has been
+ * unselected.
*/
public static final int LIST_DESELECT = 702;
- /**
- * The Constant ACTION_EVENT indicates that the user wants some
- * action to occur.
+ /**
+ * The Constant ACTION_EVENT indicates that the user wants some action to
+ * occur.
*/
public static final int ACTION_EVENT = 1001;
- /** The Constant LOAD_FILE indicates a file loading event. */
+ /**
+ * The Constant LOAD_FILE indicates a file loading event.
+ */
public static final int LOAD_FILE = 1002;
- /** The Constant SAVE_FILE indicates a file saving event. */
+ /**
+ * The Constant SAVE_FILE indicates a file saving event.
+ */
public static final int SAVE_FILE = 1003;
- /** The Constant GOT_FOCUS indicates that a component got the focus. */
+ /**
+ * The Constant GOT_FOCUS indicates that a component got the focus.
+ */
public static final int GOT_FOCUS = 1004;
- /** The Constant LOST_FOCUS indicates that the component lost the focus. */
+ /**
+ * The Constant LOST_FOCUS indicates that the component lost the focus.
+ */
public static final int LOST_FOCUS = 1005;
- /** The target is the component with which the event is associated. */
+ /**
+ * The target is the component with which the event is associated.
+ */
public Object target;
- /** The when is timestamp when event has occured. */
+ /**
+ * The when is timestamp when event has occured.
+ */
public long when;
- /** The id indicates the type of the event. */
+ /**
+ * The id indicates the type of the event.
+ */
public int id;
- /** The x coordinate of event. */
+ /**
+ * The x coordinate of event.
+ */
public int x;
- /** The y coordinate of event. */
+ /**
+ * The y coordinate of event.
+ */
public int y;
- /** The key code of key event. */
+ /**
+ * The key code of key event.
+ */
public int key;
- /** The state of the modifier keys (given by a bitmask). */
+ /**
+ * The state of the modifier keys (given by a bitmask).
+ */
public int modifiers;
- /** The click count indicates the number of consecutive clicks. */
+ /**
+ * The click count indicates the number of consecutive clicks.
+ */
public int clickCount;
- /** The argument of the event. */
+ /**
+ * The argument of the event.
+ */
public Object arg;
- /** The next event. */
+ /**
+ * The next event.
+ */
public Event evt;
/**
- * Instantiates a new event with the specified target component,
- * event type, and argument.
+ * Instantiates a new event with the specified target component, event type,
+ * and argument.
*
- * @param target the target component.
- * @param id the event type.
- * @param arg the argument.
+ * @param target
+ * the target component.
+ * @param id
+ * the event type.
+ * @param arg
+ * the argument.
*/
public Event(Object target, int id, Object arg) {
this(target, 0l, id, 0, 0, 0, 0, arg);
@@ -348,13 +452,20 @@ public class Event implements Serializable {
* event type, x and y coordinates, keyboard key, state of the modifier
* keys, and an argument set to null.
*
- * @param target the target component.
- * @param when the time stamp.
- * @param id the event type.
- * @param x the x coordinate.
- * @param y the y coordinate.
- * @param key the key.
- * @param modifiers the modifier keys state.
+ * @param target
+ * the target component.
+ * @param when
+ * the time stamp.
+ * @param id
+ * the event type.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
+ * @param key
+ * the key.
+ * @param modifiers
+ * the modifier keys state.
*/
public Event(Object target, long when, int id, int x, int y, int key, int modifiers) {
this(target, when, id, x, y, key, modifiers, null);
@@ -365,14 +476,22 @@ public class Event implements Serializable {
* event type, x and y coordinates, keyboard key, state of the modifier
* keys, and an argument.
*
- * @param target the target component.
- * @param when the time stamp.
- * @param id the event type.
- * @param x the x coordinate.
- * @param y the y coordinate.
- * @param key the key.
- * @param modifiers the modifier keys state.
- * @param arg the specified argument.
+ * @param target
+ * the target component.
+ * @param when
+ * the time stamp.
+ * @param id
+ * the event type.
+ * @param x
+ * the x coordinate.
+ * @param y
+ * the y coordinate.
+ * @param key
+ * the key.
+ * @param modifiers
+ * the modifier keys state.
+ * @param arg
+ * the specified argument.
*/
public Event(Object target, long when, int id, int x, int y, int key, int modifiers, Object arg) {
this.target = target;
@@ -392,11 +511,10 @@ public class Event implements Serializable {
*/
@Override
public String toString() {
- /* The format is based on 1.5 release behavior
- * which can be revealed by the following code:
- *
- * Event e = new Event(new Button(), 0l, Event.KEY_PRESS,
- * 0, 0, Event.TAB, Event.SHIFT_MASK, "arg");
+ /*
+ * The format is based on 1.5 release behavior which can be revealed by
+ * the following code: Event e = new Event(new Button(), 0l,
+ * Event.KEY_PRESS, 0, 0, Event.TAB, Event.SHIFT_MASK, "arg");
* System.out.println(e);
*/
@@ -410,15 +528,15 @@ public class Event implements Serializable {
*/
protected String paramString() {
return "id=" + id + ",x=" + x + ",y=" + y + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- (key != 0 ? ",key=" + key + getModifiersString() : "") + //$NON-NLS-1$ //$NON-NLS-2$
- ",target=" + target + //$NON-NLS-1$
- (arg != null ? ",arg=" + arg : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ (key != 0 ? ",key=" + key + getModifiersString() : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ ",target=" + target + //$NON-NLS-1$
+ (arg != null ? ",arg=" + arg : ""); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* Gets a string representation of the modifiers.
*
- * @return a string representation of the modifiers
+ * @return a string representation of the modifiers.
*/
private String getModifiersString() {
String strMod = ""; //$NON-NLS-1$
@@ -435,13 +553,13 @@ public class Event implements Serializable {
}
/**
- * Translates x and y coordinates of his event to the x+dx and x+dy
+ * Translates x and y coordinates of his event to the x+dx and x+dy
* coordinates.
*
- * @param dx the dx - the distance by which the event's x coordinate
- * is increased
- * @param dy the dy - the distance by which the event's y coordinate
- * is increased
+ * @param dx
+ * the distance by which the event's x coordinate is increased.
+ * @param dy
+ * the distance by which the event's y coordinate is increased.
*/
public void translate(int dx, int dy) {
x += dx;
@@ -476,4 +594,3 @@ public class Event implements Serializable {
}
}
-
diff --git a/awt/java/awt/EventQueue.java b/awt/java/awt/EventQueue.java
index 3997546190c902900a78923e456b85117e5069fc..126a593061ed490d2038375e1e9db3d3eccb3a14 100644
--- a/awt/java/awt/EventQueue.java
+++ b/awt/java/awt/EventQueue.java
@@ -18,6 +18,7 @@
* @author Michael Danilov, Pavel Dolgov
* @version $Revision$
*/
+
package java.awt;
import java.awt.event.InvocationEvent;
@@ -25,60 +26,69 @@ import java.lang.reflect.InvocationTargetException;
import java.util.EmptyStackException;
/**
- * The EventQueue class manages events. It is a platform-independent class
- * that queues events both from the underlying peer classes and from trusted
+ * The EventQueue class manages events. It is a platform-independent class that
+ * queues events both from the underlying peer classes and from trusted
* application classes.
+ *
+ * @since Android 1.0
*/
public class EventQueue {
-
- /** The core ref. */
- private final EventQueueCoreAtomicReference coreRef =
- new EventQueueCoreAtomicReference();
-
+
+ /**
+ * The core ref.
+ */
+ private final EventQueueCoreAtomicReference coreRef = new EventQueueCoreAtomicReference();
+
/**
* The Class EventQueueCoreAtomicReference.
*/
private static final class EventQueueCoreAtomicReference {
-
- /** The core. */
+
+ /**
+ * The core.
+ */
private EventQueueCore core;
- /*synchronized*/ /**
+ /* synchronized */
+ /**
* Gets the.
*
- * @return the event queue core
+ * @return the event queue core.
*/
- EventQueueCore get() {
+ EventQueueCore get() {
return core;
}
- /*synchronized*/ /**
+ /* synchronized */
+ /**
* Sets the.
*
- * @param newCore the new core
+ * @param newCore
+ * the new core.
*/
- void set(EventQueueCore newCore) {
+ void set(EventQueueCore newCore) {
core = newCore;
}
}
/**
- * Returns true if the calling thread is the current
- * AWT EventQueue's dispatch thread.
+ * Returns true if the calling thread is the current AWT EventQueue's
+ * dispatch thread.
*
- * @return true, if the calling thread is the current
- * AWT EventQueue's dispatch thread; false otherwise.
+ * @return true, if the calling thread is the current AWT EventQueue's
+ * dispatch thread; false otherwise.
*/
public static boolean isDispatchThread() {
return Thread.currentThread() instanceof EventDispatchThread;
}
/**
- * Posts an InvocationEvent which executes the run() method on a Runnable
+ * Posts an InvocationEvent which executes the run() method on a Runnable
* when dispatched by the AWT event dispatcher thread.
*
- * @param runnable the Runnable whose run method should be executed
- * synchronously on the EventQueue.
+ * @param runnable
+ * the Runnable whose run method should be executed synchronously
+ * on the EventQueue.
*/
public static void invokeLater(Runnable runnable) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
@@ -87,29 +97,28 @@ public class EventQueue {
}
/**
- * Posts an InvocationEvent which executes the run() method on a Runnable
- * when dispatched by the AWT event dispatcher thread and the
- * notifyAll method is called on it immediately after run returns.
- *
- * @param runnable the Runnable whose run method should be executed
- * synchronously on the EventQueue.
+ * Posts an InvocationEvent which executes the run() method on a Runnable
+ * when dispatched by the AWT event dispatcher thread and the notifyAll
+ * method is called on it immediately after run returns.
*
- * @throws InterruptedException if another thread has interrupted
- * this thread.
- * @throws InvocationTargetException if a throwable is thrown
- * when running the runnable.
+ * @param runnable
+ * the Runnable whose run method should be executed synchronously
+ * on the EventQueue.
+ * @throws InterruptedException
+ * if another thread has interrupted this thread.
+ * @throws InvocationTargetException
+ * if an error occurred while running the runnable.
*/
- public static void invokeAndWait(Runnable runnable)
- throws InterruptedException, InvocationTargetException {
+ public static void invokeAndWait(Runnable runnable) throws InterruptedException,
+ InvocationTargetException {
if (isDispatchThread()) {
throw new Error();
}
final Toolkit toolkit = Toolkit.getDefaultToolkit();
- final Object notifier = new Object(); //$NON-LOCK-1$
- InvocationEvent event = new InvocationEvent(
- toolkit, runnable, notifier, true);
+ final Object notifier = new Object(); // $NON-LOCK-1$
+ InvocationEvent event = new InvocationEvent(toolkit, runnable, notifier, true);
synchronized (notifier) {
toolkit.getSystemEventQueueImpl().postEvent(event);
@@ -126,7 +135,7 @@ public class EventQueue {
/**
* Gets the system event queue.
*
- * @return the system event queue
+ * @return the system event queue.
*/
private static EventQueue getSystemEventQueue() {
Thread th = Thread.currentThread();
@@ -135,48 +144,45 @@ public class EventQueue {
}
return null;
}
-
+
/**
- * Gets the most recent event's timestamp.
- * This event was dispatched from the EventQueue associated with the
- * calling thread.
+ * Gets the most recent event's timestamp. This event was dispatched from
+ * the EventQueue associated with the calling thread.
*
- * @return the timestamp of the last Event to be dispatched,
- * or System.currentTimeMillis() if this method is invoked from
- * a thread other than an event-dispatching thread.
+ * @return the timestamp of the last Event to be dispatched, or
+ * System.currentTimeMillis() if this method is invoked from a
+ * thread other than an event-dispatching thread.
*/
public static long getMostRecentEventTime() {
EventQueue eq = getSystemEventQueue();
- return (eq != null) ?
- eq.getMostRecentEventTimeImpl() : System.currentTimeMillis();
+ return (eq != null) ? eq.getMostRecentEventTimeImpl() : System.currentTimeMillis();
}
-
+
/**
* Gets the most recent event time impl.
*
- * @return the most recent event time impl
+ * @return the most recent event time impl.
*/
private long getMostRecentEventTimeImpl() {
return getCore().getMostRecentEventTime();
}
/**
- * Returns the the currently dispatched event by the EventQueue
- * associated with the calling thread.
+ * Returns the the currently dispatched event by the EventQueue associated
+ * with the calling thread.
*
- * @return the currently dispatched event or null if this method
- * is invoked from a thread other than an event-dispatching thread.
+ * @return the currently dispatched event or null if this method is invoked
+ * from a thread other than an event-dispatching thread.
*/
public static AWTEvent getCurrentEvent() {
EventQueue eq = getSystemEventQueue();
- return (eq != null) ?
- eq.getCurrentEventImpl() : null;
+ return (eq != null) ? eq.getCurrentEventImpl() : null;
}
/**
* Gets the current event impl.
*
- * @return the current event impl
+ * @return the current event impl.
*/
private AWTEvent getCurrentEventImpl() {
return getCore().getCurrentEvent();
@@ -192,7 +198,8 @@ public class EventQueue {
/**
* Instantiates a new event queue.
*
- * @param t the t
+ * @param t
+ * the t.
*/
EventQueue(Toolkit t) {
setCore(new EventQueueCore(this, t));
@@ -201,7 +208,8 @@ public class EventQueue {
/**
* Posts a event to the EventQueue.
*
- * @param event AWTEvent.
+ * @param event
+ * AWTEvent.
*/
public void postEvent(AWTEvent event) {
event.isPosted = true;
@@ -209,29 +217,28 @@ public class EventQueue {
}
/**
- * Returns an event from the EventQueue and removes it from this queue.
- *
- * @return the next AWTEvent.
+ * Returns an event from the EventQueue and removes it from this queue.
*
- * @throws InterruptedException is thrown if another thread
- * interrupts this thread.
+ * @return the next AWTEvent.
+ * @throws InterruptedException
+ * is thrown if another thread interrupts this thread.
*/
public AWTEvent getNextEvent() throws InterruptedException {
return getCore().getNextEvent();
}
-
+
/**
* Gets the next event no wait.
*
- * @return the next event no wait
+ * @return the next event no wait.
*/
AWTEvent getNextEventNoWait() {
return getCore().getNextEventNoWait();
}
/**
- * Returns the first event of the EventQueue (without removing it
- * from the queue).
+ * Returns the first event of the EventQueue (without removing it from the
+ * queue).
*
* @return the the first AWT event of the EventQueue.
*/
@@ -240,11 +247,11 @@ public class EventQueue {
}
/**
- * Returns the first event of the EventQueue with the specified ID
- * (without removing it from the queue).
- *
- * @param id the type ID of event.
+ * Returns the first event of the EventQueue with the specified ID (without
+ * removing it from the queue).
*
+ * @param id
+ * the type ID of event.
* @return the first event of the EventQueue with the specified ID.
*/
public AWTEvent peekEvent(int id) {
@@ -252,21 +259,22 @@ public class EventQueue {
}
/**
- * Replaces the existing EventQueue with the specified EventQueue.
- * Any pending events are transferred to the new EventQueue.
+ * Replaces the existing EventQueue with the specified EventQueue. Any
+ * pending events are transferred to the new EventQueue.
*
- * @param newEventQueue the new event queue.
+ * @param newEventQueue
+ * the new event queue.
*/
public void push(EventQueue newEventQueue) {
getCore().push(newEventQueue);
}
-
+
/**
- * Stops dispatching events using this EventQueue.
- * Any pending events are transferred to the previous EventQueue.
+ * Stops dispatching events using this EventQueue. Any pending events are
+ * transferred to the previous EventQueue.
*
- * @throws EmptyStackException is thrown if no previous push
- * was made on this EventQueue.
+ * @throws EmptyStackException
+ * is thrown if no previous push was made on this EventQueue.
*/
protected void pop() throws EmptyStackException {
getCore().pop();
@@ -275,7 +283,8 @@ public class EventQueue {
/**
* Dispatches the specified event.
*
- * @param event the AWTEvent.
+ * @param event
+ * the AWTEvent.
*/
protected void dispatchEvent(AWTEvent event) {
getCore().dispatchEventImpl(event);
@@ -284,7 +293,7 @@ public class EventQueue {
/**
* Checks if the queue is empty.
*
- * @return true, if is empty
+ * @return true, if is empty.
*/
boolean isEmpty() {
return getCore().isEmpty();
@@ -293,16 +302,17 @@ public class EventQueue {
/**
* Gets the core.
*
- * @return the core
+ * @return the core.
*/
EventQueueCore getCore() {
return coreRef.get();
}
-
+
/**
* Sets the core.
*
- * @param newCore the new core
+ * @param newCore
+ * the new core.
*/
void setCore(EventQueueCore newCore) {
coreRef.set((newCore != null) ? newCore : new EventQueueCore(this));
diff --git a/awt/java/awt/Font.java b/awt/java/awt/Font.java
index 139ae6827a37697385f66764a491024ca75ba7c0..4ed93438d3892cd6c8a429af08b25e1a558e8a4a 100644
--- a/awt/java/awt/Font.java
+++ b/awt/java/awt/Font.java
@@ -46,130 +46,165 @@ import org.apache.harmony.awt.gl.font.FontPeerImpl;
import org.apache.harmony.awt.gl.font.FontMetricsImpl;
import org.apache.harmony.awt.gl.font.LineMetricsImpl;
import org.apache.harmony.awt.internal.nls.Messages;
+import org.apache.harmony.luni.util.NotImplementedException;
import org.apache.harmony.misc.HashCode;
-
/**
- * The Font class represents fonts for rendering text.
- * This class allow to map characters to glyphs.
- *
- * A glyph is a shape used to render a character or a sequence of
- * characters. For example one character of Latin writing system
- * represented by one glyth, but in complex writing system such as
- * South and South-East Asian there is more complicated correspondence
- * between characters and glyphs.
+ * The Font class represents fonts for rendering text. This class allow to map
+ * characters to glyphs.
+ *
+ * A glyph is a shape used to render a character or a sequence of characters.
+ * For example one character of Latin writing system represented by one glyph,
+ * but in complex writing system such as South and South-East Asian there is
+ * more complicated correspondence between characters and glyphs.
*
- * The Font object is identified by two types of names. The logical font name
- * is the name that is used to construct the font. The font name
- * is the name of a particular font face (for example, Arial Bold).
- * The family name is the font's family name that specifies
- * the typographic design across several faces (for example, Arial). In
- * all the Font is identified by three attributes: the family name,
- * the style (such as bold or italic), and the size.
+ * The Font object is identified by two types of names. The logical font name is
+ * the name that is used to construct the font. The font name is the name of a
+ * particular font face (for example, Arial Bold). The family name is the font's
+ * family name that specifies the typographic design across several faces (for
+ * example, Arial). In all the Font is identified by three attributes: the
+ * family name, the style (such as bold or italic), and the size.
+ *
+ * @since Android 1.0
*/
public class Font implements Serializable {
- /** The Constant serialVersionUID. */
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -4206021311591459213L;
// Identity Transform attribute
- /** The Constant IDENTITY_TRANSFORM. */
+ /**
+ * The Constant IDENTITY_TRANSFORM.
+ */
private static final TransformAttribute IDENTITY_TRANSFORM = new TransformAttribute(
new AffineTransform());
- /** The Constant PLAIN indicates font's plain style. */
+ /**
+ * The Constant PLAIN indicates font's plain style.
+ */
public static final int PLAIN = 0;
- /** The Constant BOLD indicates font's bold style. */
+ /**
+ * The Constant BOLD indicates font's bold style.
+ */
public static final int BOLD = 1;
- /** The Constant ITALIC indicates font's italic style. */
+ /**
+ * The Constant ITALIC indicates font's italic style.
+ */
public static final int ITALIC = 2;
- /** The Constant ROMAN_BASELINE indicated roman baseline. */
+ /**
+ * The Constant ROMAN_BASELINE indicated roman baseline.
+ */
public static final int ROMAN_BASELINE = 0;
- /** The Constant CENTER_BASELINE indicates center baseline. */
+ /**
+ * The Constant CENTER_BASELINE indicates center baseline.
+ */
public static final int CENTER_BASELINE = 1;
- /** The Constant HANGING_BASELINE indicates hanging baseline. */
+ /**
+ * The Constant HANGING_BASELINE indicates hanging baseline.
+ */
public static final int HANGING_BASELINE = 2;
- /**
- * The Constant TRUETYPE_FONT indicates a font resource of
- * type TRUETYPE.
+ /**
+ * The Constant TRUETYPE_FONT indicates a font resource of type TRUETYPE.
*/
public static final int TRUETYPE_FONT = 0;
- /**
- * The Constant TYPE1_FONT indicates a font resource of
- * type TYPE1.
+ /**
+ * The Constant TYPE1_FONT indicates a font resource of type TYPE1.
*/
public static final int TYPE1_FONT = 1;
- /**
- * The Constant LAYOUT_LEFT_TO_RIGHT indicates that text is
- * left to right.
+ /**
+ * The Constant LAYOUT_LEFT_TO_RIGHT indicates that text is left to right.
*/
public static final int LAYOUT_LEFT_TO_RIGHT = 0;
- /**
- * The Constant LAYOUT_RIGHT_TO_LEFT indicates that text is
- * right to left.
+ /**
+ * The Constant LAYOUT_RIGHT_TO_LEFT indicates that text is right to left.
*/
public static final int LAYOUT_RIGHT_TO_LEFT = 1;
- /**
- * The Constant LAYOUT_NO_START_CONTEXT indicates that the text
- * in the char array before the indicated start should not be examined.
+ /**
+ * The Constant LAYOUT_NO_START_CONTEXT indicates that the text in the char
+ * array before the indicated start should not be examined.
*/
public static final int LAYOUT_NO_START_CONTEXT = 2;
- /** The Constant LAYOUT_NO_LIMIT_CONTEXT indicates that text in
- * the char array after the indicated limit should not be examined. */
+ /**
+ * The Constant LAYOUT_NO_LIMIT_CONTEXT indicates that text in the char
+ * array after the indicated limit should not be examined.
+ */
public static final int LAYOUT_NO_LIMIT_CONTEXT = 4;
- /** The Constant DEFAULT_FONT. */
+ /**
+ * The Constant DEFAULT_FONT.
+ */
static final Font DEFAULT_FONT = new Font("Dialog", Font.PLAIN, 12); //$NON-NLS-1$
- /** The name of the Font. */
+ /**
+ * The name of the Font.
+ */
protected String name;
- /** The style of the Font. */
+ /**
+ * The style of the Font.
+ */
protected int style;
- /** The size of the Font. */
+ /**
+ * The size of the Font.
+ */
protected int size;
- /** The point size of the Font. */
+ /**
+ * The point size of the Font.
+ */
protected float pointSize;
// Flag if the Font object transformed
- /** The transformed. */
+ /**
+ * The transformed.
+ */
private boolean transformed;
// Set of font attributes
- /** The requested attributes. */
+ /**
+ * The requested attributes.
+ */
private Hashtable fRequestedAttributes;
// font peer object corresponding to this Font
- /** The font peer. */
+ /**
+ * The font peer.
+ */
private transient FontPeerImpl fontPeer;
// number of glyphs in this Font
- /** The num glyphs. */
+ /**
+ * The num glyphs.
+ */
private transient int numGlyphs = -1;
// code for missing glyph for this Font
- /** The missing glyph code. */
+ /**
+ * The missing glyph code.
+ */
private transient int missingGlyphCode = -1;
/**
* Writes object to ObjectOutputStream.
*
- * @param out ObjectOutputStream
- *
- * @throws IOException Signals that an I/O exception has occurred.
+ * @param out
+ * ObjectOutputStream.
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
*/
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
@@ -179,10 +214,12 @@ public class Font implements Serializable {
* Reads object from ObjectInputStream object and set native platform
* dependent fields to default values.
*
- * @param in ObjectInputStream object
- *
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws ClassNotFoundException the class not found exception
+ * @param in
+ * ObjectInputStream object.
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ * @throws ClassNotFoundException
+ * the class not found exception.
*/
private void readObject(java.io.ObjectInputStream in) throws IOException,
ClassNotFoundException {
@@ -194,11 +231,11 @@ public class Font implements Serializable {
}
/**
- * Instantiates a new Font with the specified attributes.
- * The Font will be created with default attributes
- * if the attribute's parameter is null.
+ * Instantiates a new Font with the specified attributes. The Font will be
+ * created with default attributes if the attribute's parameter is null.
*
- * @param attributes the attributes to be assigned to the new Font, or null.
+ * @param attributes
+ * the attributes to be assigned to the new Font, or null.
*/
public Font(Map extends Attribute, ?> attributes) {
Object currAttr;
@@ -217,43 +254,38 @@ public class Font implements Serializable {
currAttr = attributes.get(TextAttribute.SIZE);
if (currAttr != null) {
- this.pointSize = ((Float) currAttr).floatValue();
- this.size = (int) Math.ceil(this.pointSize);
+ this.pointSize = ((Float)currAttr).floatValue();
+ this.size = (int)Math.ceil(this.pointSize);
}
currAttr = attributes.get(TextAttribute.POSTURE);
- if (currAttr != null
- && currAttr.equals(TextAttribute.POSTURE_OBLIQUE)) {
+ if (currAttr != null && currAttr.equals(TextAttribute.POSTURE_OBLIQUE)) {
this.style |= Font.ITALIC;
}
currAttr = attributes.get(TextAttribute.WEIGHT);
if ((currAttr != null)
- && (((Float) currAttr).floatValue() >= (TextAttribute.WEIGHT_BOLD)
- .floatValue())) {
+ && (((Float)currAttr).floatValue() >= (TextAttribute.WEIGHT_BOLD).floatValue())) {
this.style |= Font.BOLD;
}
currAttr = attributes.get(TextAttribute.FAMILY);
if (currAttr != null) {
- this.name = (String) currAttr;
+ this.name = (String)currAttr;
}
currAttr = attributes.get(TextAttribute.TRANSFORM);
if (currAttr != null) {
if (currAttr instanceof TransformAttribute) {
- this.transformed = !((TransformAttribute) currAttr)
- .getTransform().isIdentity();
+ this.transformed = !((TransformAttribute)currAttr).getTransform().isIdentity();
} else if (currAttr instanceof AffineTransform) {
- this.transformed = !((AffineTransform) currAttr)
- .isIdentity();
+ this.transformed = !((AffineTransform)currAttr).isIdentity();
}
}
} else {
fRequestedAttributes = new Hashtable(5);
- fRequestedAttributes.put(TextAttribute.TRANSFORM,
- IDENTITY_TRANSFORM);
+ fRequestedAttributes.put(TextAttribute.TRANSFORM, IDENTITY_TRANSFORM);
this.transformed = false;
@@ -262,18 +294,14 @@ public class Font implements Serializable {
fRequestedAttributes.put(TextAttribute.SIZE, new Float(this.size));
if ((this.style & Font.BOLD) != 0) {
- fRequestedAttributes.put(TextAttribute.WEIGHT,
- TextAttribute.WEIGHT_BOLD);
+ fRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
} else {
- fRequestedAttributes.put(TextAttribute.WEIGHT,
- TextAttribute.WEIGHT_REGULAR);
+ fRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR);
}
if ((this.style & Font.ITALIC) != 0) {
- fRequestedAttributes.put(TextAttribute.POSTURE,
- TextAttribute.POSTURE_OBLIQUE);
+ fRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
} else {
- fRequestedAttributes.put(TextAttribute.POSTURE,
- TextAttribute.POSTURE_REGULAR);
+ fRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);
}
}
@@ -282,9 +310,12 @@ public class Font implements Serializable {
/**
* Instantiates a new Font with the specified name, style and size.
*
- * @param name the name of font.
- * @param style the style of font.
- * @param size the size of font.
+ * @param name
+ * the name of font.
+ * @param style
+ * the style of font.
+ * @param size
+ * the size of font.
*/
public Font(String name, int style, int size) {
@@ -303,46 +334,43 @@ public class Font implements Serializable {
fRequestedAttributes.put(TextAttribute.SIZE, new Float(this.size));
if ((this.style & Font.BOLD) != 0) {
- fRequestedAttributes.put(TextAttribute.WEIGHT,
- TextAttribute.WEIGHT_BOLD);
+ fRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
} else {
- fRequestedAttributes.put(TextAttribute.WEIGHT,
- TextAttribute.WEIGHT_REGULAR);
+ fRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR);
}
if ((this.style & Font.ITALIC) != 0) {
- fRequestedAttributes.put(TextAttribute.POSTURE,
- TextAttribute.POSTURE_OBLIQUE);
+ fRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
} else {
- fRequestedAttributes.put(TextAttribute.POSTURE,
- TextAttribute.POSTURE_REGULAR);
+ fRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);
}
}
/**
* Returns true if this Font has a glyph for the specified character.
*
- * @param c the character.
- *
- * @return true if this Font has a glyph for the specified character,
- * false otherwise.
+ * @param c
+ * the character.
+ * @return true if this Font has a glyph for the specified character, false
+ * otherwise.
*/
public boolean canDisplay(char c) {
- FontPeerImpl peer = (FontPeerImpl) this.getPeer();
+ FontPeerImpl peer = (FontPeerImpl)this.getPeer();
return peer.canDisplay(c);
}
/**
- * Returns true if the Font can display the characters of the
- * the specified text from the specified start position
- * to the specified limit position.
- *
- * @param text the text.
- * @param start the start offset (in the character array).
- * @param limit the limit offset (in the character array).
- *
- * @return the a character's position in the text that this Font
- * can not display, or -1 if this Font can display all characters
- * in this text.
+ * Returns true if the Font can display the characters of the the specified
+ * text from the specified start position to the specified limit position.
+ *
+ * @param text
+ * the text.
+ * @param start
+ * the start offset (in the character array).
+ * @param limit
+ * the limit offset (in the character array).
+ * @return the a character's position in the text that this Font can not
+ * display, or -1 if this Font can display all characters in this
+ * text.
*/
public int canDisplayUpTo(char[] text, int start, int limit) {
int st = start;
@@ -361,17 +389,19 @@ public class Font implements Serializable {
}
/**
- * Returns true if the Font can display the characters of the
- * the specified CharacterIterator from the specified start position
- * and the specified limit position.
- *
- * @param iter the CharacterIterator.
- * @param start the start offset.
- * @param limit the limit offset.
- *
- * @return the a character's position in the CharacterIterator
- * that this Font can not display, or -1 if this Font can display
- * all characters in this text.
+ * Returns true if the Font can display the characters of the the specified
+ * CharacterIterator from the specified start position and the specified
+ * limit position.
+ *
+ * @param iter
+ * the CharacterIterator.
+ * @param start
+ * the start offset.
+ * @param limit
+ * the limit offset.
+ * @return the a character's position in the CharacterIterator that this
+ * Font can not display, or -1 if this Font can display all
+ * characters in this text.
*/
public int canDisplayUpTo(CharacterIterator iter, int start, int limit) {
int st = start;
@@ -394,11 +424,11 @@ public class Font implements Serializable {
/**
* Returns true if this Font can display a specified String.
*
- * @param str the String.
- *
- * @return the a character's position in the String that
- * this Font can not display, or -1 if this Font can display
- * all characters in this text.
+ * @param str
+ * the String.
+ * @return the a character's position in the String that this Font can not
+ * display, or -1 if this Font can display all characters in this
+ * text.
*/
public int canDisplayUpTo(String str) {
char[] chars = str.toCharArray();
@@ -406,45 +436,49 @@ public class Font implements Serializable {
}
/**
- * Creates a GlyphVector of associating characters to glyphs
- * based on the unicode map of this Font.
- *
- * @param frc the FontRenderContext.
- * @param chars the characters array.
+ * Creates a GlyphVector of associating characters to glyphs based on the
+ * Unicode map of this Font.
*
- * @return the GlyphVector of associating characters to glyphs
- * based on the unicode map of this Font.
+ * @param frc
+ * the FontRenderContext.
+ * @param chars
+ * the characters array.
+ * @return the GlyphVector of associating characters to glyphs based on the
+ * Unicode map of this Font.
*/
public GlyphVector createGlyphVector(FontRenderContext frc, char[] chars) {
return new AndroidGlyphVector(chars, frc, this, 0);
}
/**
- * Creates a GlyphVector of associating characters contained
- * in the specified CharacterIterator to glyphs based on
- * the unicode map of this Font.
- *
- * @param frc the FontRenderContext.
- * @param iter the CharacterIterator.
- *
- * @return the GlyphVector of associating characters contained
- * in the specified CharacterIterator to glyphs
- * based on the unicode map of this Font.
- */
- public GlyphVector createGlyphVector(FontRenderContext frc,
- CharacterIterator iter) {
- throw new RuntimeException("Not implemented!"); //$NON-NLS-1$
+ * Creates a GlyphVector of associating characters contained in the
+ * specified CharacterIterator to glyphs based on the Unicode map of this
+ * Font.
+ *
+ * @param frc
+ * the FontRenderContext.
+ * @param iter
+ * the CharacterIterator.
+ * @return the GlyphVector of associating characters contained in the
+ * specified CharacterIterator to glyphs based on the Unicode map of
+ * this Font.
+ */
+ public GlyphVector createGlyphVector(FontRenderContext frc, CharacterIterator iter) {
+ throw new RuntimeException("Not implemented!"); //$NON-NLS-1$
}
/**
- * Creates a GlyphVector of associating characters to glyphs based on
- * the unicode map of this Font.
- *
- * @param frc the FontRenderContext.
- * @param glyphCodes the specified integer array of glyph codes.
- *
- * @return the GlyphVector of associating characters to glyphs
- * based on the unicode map of this Font.
+ * Creates a GlyphVector of associating characters to glyphs based on the
+ * Unicode map of this Font.
+ *
+ * @param frc
+ * the FontRenderContext.
+ * @param glyphCodes
+ * the specified integer array of glyph codes.
+ * @return the GlyphVector of associating characters to glyphs based on the
+ * Unicode map of this Font.
+ * @throws NotImplementedException
+ * if this method is not implemented by a subclass.
*/
public GlyphVector createGlyphVector(FontRenderContext frc, int[] glyphCodes)
throws org.apache.harmony.luni.util.NotImplementedException {
@@ -452,14 +486,15 @@ public class Font implements Serializable {
}
/**
- * Creates a GlyphVector of associating characters to glyphs based on
- * the unicode map of this Font.
+ * Creates a GlyphVector of associating characters to glyphs based on the
+ * Unicode map of this Font.
*
- * @param frc the FontRenderContext.
- * @param str the specified String.
- *
- * @return the GlyphVector of associating characters to glyphs
- * based on the unicode map of this Font.
+ * @param frc
+ * the FontRenderContext.
+ * @param str
+ * the specified String.
+ * @return the GlyphVector of associating characters to glyphs based on the
+ * Unicode map of this Font.
*/
public GlyphVector createGlyphVector(FontRenderContext frc, String str) {
return new AndroidGlyphVector(str.toCharArray(), frc, this, 0);
@@ -467,14 +502,14 @@ public class Font implements Serializable {
}
/**
- * Returns the font style constant value corresponding to one of the font style
- * names ("BOLD", "ITALIC", "BOLDITALIC"). This method returns Font.PLAIN if
- * the argument is not one of the predefined style names.
- *
- * @param fontStyleName font style name
+ * Returns the font style constant value corresponding to one of the font
+ * style names ("BOLD", "ITALIC", "BOLDITALIC"). This method returns
+ * Font.PLAIN if the argument is not one of the predefined style names.
*
+ * @param fontStyleName
+ * font style name.
* @return font style constant value corresponding to the font style name
- * specified.
+ * specified.
*/
private static int getFontStyle(String fontStyleName) {
int result = Font.PLAIN;
@@ -491,12 +526,12 @@ public class Font implements Serializable {
}
/**
- * Decodes the specified string which described the Font. The string
- * should have the following format: fontname-style-pointsize.
- * The style can be PLAIN, BOLD, BOLDITALIC, or ITALIC.
- *
- * @param str the string which describes the font.
+ * Decodes the specified string which described the Font. The string should
+ * have the following format: fontname-style-pointsize. The style can be
+ * PLAIN, BOLD, BOLDITALIC, or ITALIC.
*
+ * @param str
+ * the string which describes the font.
* @return the Font from the specified string.
*/
public static Font decode(String str) {
@@ -553,15 +588,14 @@ public class Font implements Serializable {
}
/**
- * Perfoms the specified affine transform to the Font and returns
- * a new Font.
- *
- * @param trans the AffineTransform.
+ * Performs the specified affine transform to the Font and returns a new
+ * Font.
*
+ * @param trans
+ * the AffineTransform.
* @return the Font object.
- *
- * @throws IllegalArgumentException if affine transform parameter
- * is null.
+ * @throws IllegalArgumentException
+ * if affine transform parameter is null.
*/
@SuppressWarnings("unchecked")
public Font deriveFont(AffineTransform trans) {
@@ -571,55 +605,52 @@ public class Font implements Serializable {
throw new IllegalArgumentException(Messages.getString("awt.94")); //$NON-NLS-1$
}
- Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes
+ Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes
.clone();
- derivefRequestedAttributes.put(TextAttribute.TRANSFORM,
- new TransformAttribute(trans));
+ derivefRequestedAttributes.put(TextAttribute.TRANSFORM, new TransformAttribute(trans));
return new Font(derivefRequestedAttributes);
}
/**
- * Returns a new Font that is a copy of the current Font
- * modified so that the size is the specified size.
- *
- * @param size the size of font.
+ * Returns a new Font that is a copy of the current Font modified so that
+ * the size is the specified size.
*
+ * @param size
+ * the size of font.
* @return the Font object.
*/
@SuppressWarnings("unchecked")
public Font deriveFont(float size) {
- Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes
+ Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes
.clone();
derivefRequestedAttributes.put(TextAttribute.SIZE, new Float(size));
return new Font(derivefRequestedAttributes);
}
/**
- * Returns a new Font that is a copy of the current Font
- * modified so that the style is the specified style.
- *
- * @param style the style of font.
+ * Returns a new Font that is a copy of the current Font modified so that
+ * the style is the specified style.
*
+ * @param style
+ * the style of font.
* @return the Font object.
*/
@SuppressWarnings("unchecked")
public Font deriveFont(int style) {
- Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes
+ Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes
.clone();
if ((style & Font.BOLD) != 0) {
- derivefRequestedAttributes.put(TextAttribute.WEIGHT,
- TextAttribute.WEIGHT_BOLD);
+ derivefRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
} else if (derivefRequestedAttributes.get(TextAttribute.WEIGHT) != null) {
derivefRequestedAttributes.remove(TextAttribute.WEIGHT);
}
if ((style & Font.ITALIC) != 0) {
- derivefRequestedAttributes.put(TextAttribute.POSTURE,
- TextAttribute.POSTURE_OBLIQUE);
+ derivefRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
} else if (derivefRequestedAttributes.get(TextAttribute.POSTURE) != null) {
derivefRequestedAttributes.remove(TextAttribute.POSTURE);
}
@@ -628,13 +659,14 @@ public class Font implements Serializable {
}
/**
- * Returns a new Font that is a copy of the current Font
- * modified to match the specified style and with the specified
- * affine transform applied to its glyphs.
- *
- * @param style the style of font.
- * @param trans the AffineTransform.
- *
+ * Returns a new Font that is a copy of the current Font modified to match
+ * the specified style and with the specified affine transform applied to
+ * its glyphs.
+ *
+ * @param style
+ * the style of font.
+ * @param trans
+ * the AffineTransform.
* @return the Font object.
*/
@SuppressWarnings("unchecked")
@@ -644,53 +676,48 @@ public class Font implements Serializable {
// awt.94=transform can not be null
throw new IllegalArgumentException(Messages.getString("awt.94")); //$NON-NLS-1$
}
- Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes
+ Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes
.clone();
if ((style & BOLD) != 0) {
- derivefRequestedAttributes.put(TextAttribute.WEIGHT,
- TextAttribute.WEIGHT_BOLD);
+ derivefRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
} else if (derivefRequestedAttributes.get(TextAttribute.WEIGHT) != null) {
derivefRequestedAttributes.remove(TextAttribute.WEIGHT);
}
if ((style & ITALIC) != 0) {
- derivefRequestedAttributes.put(TextAttribute.POSTURE,
- TextAttribute.POSTURE_OBLIQUE);
+ derivefRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
} else if (derivefRequestedAttributes.get(TextAttribute.POSTURE) != null) {
derivefRequestedAttributes.remove(TextAttribute.POSTURE);
}
- derivefRequestedAttributes.put(TextAttribute.TRANSFORM,
- new TransformAttribute(trans));
+ derivefRequestedAttributes.put(TextAttribute.TRANSFORM, new TransformAttribute(trans));
return new Font(derivefRequestedAttributes);
}
/**
- * Returns a new Font that is a copy of the current Font
- * modified so that the size and style are the specified
- * size and style.
- *
- * @param style the style of font.
- * @param size the size of font.
+ * Returns a new Font that is a copy of the current Font modified so that
+ * the size and style are the specified size and style.
*
+ * @param style
+ * the style of font.
+ * @param size
+ * the size of font.
* @return the Font object.
*/
@SuppressWarnings("unchecked")
public Font deriveFont(int style, float size) {
- Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes
+ Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes
.clone();
if ((style & BOLD) != 0) {
- derivefRequestedAttributes.put(TextAttribute.WEIGHT,
- TextAttribute.WEIGHT_BOLD);
+ derivefRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
} else if (derivefRequestedAttributes.get(TextAttribute.WEIGHT) != null) {
derivefRequestedAttributes.remove(TextAttribute.WEIGHT);
}
if ((style & ITALIC) != 0) {
- derivefRequestedAttributes.put(TextAttribute.POSTURE,
- TextAttribute.POSTURE_OBLIQUE);
+ derivefRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
} else if (derivefRequestedAttributes.get(TextAttribute.POSTURE) != null) {
derivefRequestedAttributes.remove(TextAttribute.POSTURE);
}
@@ -703,15 +730,15 @@ public class Font implements Serializable {
/**
* Returns a new Font object with a new set of font attributes.
*
- * @param attributes the map of attributes.
- *
+ * @param attributes
+ * the map of attributes.
* @return the Font.
*/
@SuppressWarnings("unchecked")
public Font deriveFont(Map extends Attribute, ?> attributes) {
Attribute[] avalAttributes = this.getAvailableAttributes();
- Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes
+ Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes
.clone();
Object currAttribute;
for (Attribute element : avalAttributes) {
@@ -726,10 +753,10 @@ public class Font implements Serializable {
/**
* Compares the specified Object with the current Font.
*
- * @param obj the Object to be compared.
- *
- * @return true, if the specified Object is an instance of Font
- * with the same family, size, and style as this Font, false otherwise.
+ * @param obj
+ * the Object to be compared.
+ * @return true, if the specified Object is an instance of Font with the
+ * same family, size, and style as this Font, false otherwise.
*/
@Override
public boolean equals(Object obj) {
@@ -739,11 +766,10 @@ public class Font implements Serializable {
if (obj != null) {
try {
- Font font = (Font) obj;
+ Font font = (Font)obj;
return ((this.style == font.style) && (this.size == font.size)
- && this.name.equals(font.name)
- && (this.pointSize == font.pointSize) && (this
+ && this.name.equals(font.name) && (this.pointSize == font.pointSize) && (this
.getTransform()).equals(font.getTransform()));
} catch (ClassCastException e) {
}
@@ -759,7 +785,7 @@ public class Font implements Serializable {
*/
@SuppressWarnings("unchecked")
public Map getAttributes() {
- return (Map) fRequestedAttributes.clone();
+ return (Map)fRequestedAttributes.clone();
}
/**
@@ -768,18 +794,19 @@ public class Font implements Serializable {
* @return the keys array of all available attributes.
*/
public Attribute[] getAvailableAttributes() {
- Attribute[] attrs = { TextAttribute.FAMILY, TextAttribute.POSTURE,
- TextAttribute.SIZE, TextAttribute.TRANSFORM,
- TextAttribute.WEIGHT, TextAttribute.SUPERSCRIPT,
- TextAttribute.WIDTH };
+ Attribute[] attrs = {
+ TextAttribute.FAMILY, TextAttribute.POSTURE, TextAttribute.SIZE,
+ TextAttribute.TRANSFORM, TextAttribute.WEIGHT, TextAttribute.SUPERSCRIPT,
+ TextAttribute.WIDTH
+ };
return attrs;
}
/**
* Gets the baseline for this character.
*
- * @param c the character.
- *
+ * @param c
+ * the character.
* @return the baseline for this character.
*/
public byte getBaselineFor(char c) {
@@ -800,19 +827,18 @@ public class Font implements Serializable {
}
/**
- * Returns the family name of this Font associated with
- * the specified locale.
- *
- * @param l the locale.
+ * Returns the family name of this Font associated with the specified
+ * locale.
*
- * @return the family name of this Font associated with
- * the specified locale.
+ * @param l
+ * the locale.
+ * @return the family name of this Font associated with the specified
+ * locale.
*/
public String getFamily(Locale l) {
if (l == null) {
// awt.01='{0}' parameter is null
- throw new NullPointerException(Messages.getString(
- "awt.01", "Locale")); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new NullPointerException(Messages.getString("awt.01", "Locale")); //$NON-NLS-1$ //$NON-NLS-2$
}
return getFamily();
}
@@ -820,12 +846,12 @@ public class Font implements Serializable {
/**
* Gets a Font with the specified attribute set.
*
- * @param attributes the attributes to be assigned to the new Font.
- *
+ * @param attributes
+ * the attributes to be assigned to the new Font.
* @return the Font.
*/
public static Font getFont(Map extends Attribute, ?> attributes) {
- Font fnt = (Font) attributes.get(TextAttribute.FONT);
+ Font fnt = (Font)attributes.get(TextAttribute.FONT);
if (fnt != null) {
return fnt;
}
@@ -833,14 +859,16 @@ public class Font implements Serializable {
}
/**
- * Gets a Font object from the system properties list with the specified name
- * or returns the specified Font if there is no such property.
- *
- * @param sp the specified property name.
- * @param f the Font.
+ * Gets a Font object from the system properties list with the specified
+ * name or returns the specified Font if there is no such property.
*
- * @return the Font object from the system properties list with the specified name
- * or the specified Font if there is no such property.
+ * @param sp
+ * the specified property name.
+ * @param f
+ * the Font.
+ * @return the Font object from the system properties list with the
+ * specified name or the specified Font if there is no such
+ * property.
*/
public static Font getFont(String sp, Font f) {
String pr = System.getProperty(sp);
@@ -851,12 +879,13 @@ public class Font implements Serializable {
}
/**
- * Gets a Font object from the system properties list with the specified name.
- *
- * @param sp the system property name.
+ * Gets a Font object from the system properties list with the specified
+ * name.
*
- * @return the Font, or null if there is no shuch property
- * with the specified name.
+ * @param sp
+ * the system property name.
+ * @return the Font, or null if there is no such property with the specified
+ * name.
*/
public static Font getFont(String sp) {
return getFont(sp, null);
@@ -877,8 +906,8 @@ public class Font implements Serializable {
/**
* Returns the font name associated with the specified locale.
*
- * @param l the locale.
- *
+ * @param l
+ * the locale.
* @return the font name associated with the specified locale.
*/
public String getFontName(Locale l) {
@@ -888,38 +917,45 @@ public class Font implements Serializable {
/**
* Returns a LineMetrics object created with the specified parameters.
*
- * @param chars the chars array.
- * @param start the start offset.
- * @param end the end offset.
- * @param frc the FontRenderContext.
- *
+ * @param chars
+ * the chars array.
+ * @param start
+ * the start offset.
+ * @param end
+ * the end offset.
+ * @param frc
+ * the FontRenderContext.
* @return the LineMetrics for the specified parameters.
*/
- public LineMetrics getLineMetrics(char[] chars, int start, int end,
- FontRenderContext frc) {
+ public LineMetrics getLineMetrics(char[] chars, int start, int end, FontRenderContext frc) {
if (frc == null) {
// awt.00=FontRenderContext is null
throw new NullPointerException(Messages.getString("awt.00")); //$NON-NLS-1$
}
- //FontMetrics fm = AndroidGraphics2D.getInstance().getFontMetrics();
+ // FontMetrics fm = AndroidGraphics2D.getInstance().getFontMetrics();
FontMetrics fm = new FontMetricsImpl(this);
- float[] fmet = {fm.getAscent(), fm.getDescent(), fm.getLeading()};
+ float[] fmet = {
+ fm.getAscent(), fm.getDescent(), fm.getLeading()
+ };
return new LineMetricsImpl(chars.length, fmet, null);
}
/**
* Returns a LineMetrics object created with the specified parameters.
*
- * @param iter the CharacterIterator.
- * @param start the start offset.
- * @param end the end offset.
- * @param frc the FontRenderContext.
- *
+ * @param iter
+ * the CharacterIterator.
+ * @param start
+ * the start offset.
+ * @param end
+ * the end offset.
+ * @param frc
+ * the FontRenderContext.
* @return the LineMetrics for the specified parameters.
*/
- public LineMetrics getLineMetrics(CharacterIterator iter, int start,
- int end, FontRenderContext frc) {
+ public LineMetrics getLineMetrics(CharacterIterator iter, int start, int end,
+ FontRenderContext frc) {
if (frc == null) {
// awt.00=FontRenderContext is null
@@ -935,8 +971,8 @@ public class Font implements Serializable {
} else {
char[] chars = new char[iterCount];
int i = 0;
- for (char c = iter.setIndex(start); c != CharacterIterator.DONE
- && (i < iterCount); c = iter.next()) {
+ for (char c = iter.setIndex(start); c != CharacterIterator.DONE && (i < iterCount); c = iter
+ .next()) {
chars[i] = c;
i++;
}
@@ -948,16 +984,19 @@ public class Font implements Serializable {
/**
* Returns a LineMetrics object created with the specified parameters.
*
- * @param str the String.
- * @param frc the FontRenderContext.
- *
+ * @param str
+ * the String.
+ * @param frc
+ * the FontRenderContext.
* @return the LineMetrics for the specified parameters.
*/
public LineMetrics getLineMetrics(String str, FontRenderContext frc) {
- //FontMetrics fm = AndroidGraphics2D.getInstance().getFontMetrics();
+ // FontMetrics fm = AndroidGraphics2D.getInstance().getFontMetrics();
FontMetrics fm = new FontMetricsImpl(this);
- float[] fmet = {fm.getAscent(), fm.getDescent(), fm.getLeading()};
- //Log.i("FONT FMET", fmet.toString());
+ float[] fmet = {
+ fm.getAscent(), fm.getDescent(), fm.getLeading()
+ };
+ // Log.i("FONT FMET", fmet.toString());
return new LineMetricsImpl(str.length(), fmet, null);
}
@@ -965,45 +1004,48 @@ public class Font implements Serializable {
/**
* Returns a LineMetrics object created with the specified parameters.
*
- * @param str the String.
- * @param start the start offset.
- * @param end the end offset.
- * @param frc the FontRenderContext.
- *
+ * @param str
+ * the String.
+ * @param start
+ * the start offset.
+ * @param end
+ * the end offset.
+ * @param frc
+ * the FontRenderContext.
* @return the LineMetrics for the specified parameters.
*/
- public LineMetrics getLineMetrics(String str, int start, int end,
- FontRenderContext frc) {
+ public LineMetrics getLineMetrics(String str, int start, int end, FontRenderContext frc) {
return this.getLineMetrics(str.substring(start, end), frc);
}
/**
- * Gets the logical bounds of the specified String in
- * the specified FontRenderContext. The logical bounds contains
- * the origin, ascent, advance, and height.
- *
- * @param ci the specified CharacterIterator.
- * @param start the start offset.
- * @param end the end offset.
- * @param frc the FontRenderContext.
- *
+ * Gets the logical bounds of the specified String in the specified
+ * FontRenderContext. The logical bounds contains the origin, ascent,
+ * advance, and height.
+ *
+ * @param ci
+ * the specified CharacterIterator.
+ * @param start
+ * the start offset.
+ * @param end
+ * the end offset.
+ * @param frc
+ * the FontRenderContext.
* @return a Rectangle2D object.
*/
- public Rectangle2D getStringBounds(CharacterIterator ci, int start,
- int end, FontRenderContext frc) {
+ public Rectangle2D getStringBounds(CharacterIterator ci, int start, int end,
+ FontRenderContext frc) {
int first = ci.getBeginIndex();
int finish = ci.getEndIndex();
char[] chars;
if (start < first) {
// awt.95=Wrong start index: {0}
- throw new IndexOutOfBoundsException(Messages.getString(
- "awt.95", start)); //$NON-NLS-1$
+ throw new IndexOutOfBoundsException(Messages.getString("awt.95", start)); //$NON-NLS-1$
}
if (end > finish) {
// awt.96=Wrong finish index: {0}
- throw new IndexOutOfBoundsException(Messages.getString(
- "awt.96", end)); //$NON-NLS-1$
+ throw new IndexOutOfBoundsException(Messages.getString("awt.96", end)); //$NON-NLS-1$
}
if (start > end) {
// awt.97=Wrong range length: {0}
@@ -1028,13 +1070,14 @@ public class Font implements Serializable {
}
/**
- * Gets the logical bounds of the specified String in
- * the specified FontRenderContext. The logical bounds contains
- * the origin, ascent, advance, and height.
- *
- * @param str the specified String.
- * @param frc the FontRenderContext.
- *
+ * Gets the logical bounds of the specified String in the specified
+ * FontRenderContext. The logical bounds contains the origin, ascent,
+ * advance, and height.
+ *
+ * @param str
+ * the specified String.
+ * @param frc
+ * the FontRenderContext.
* @return a Rectangle2D object.
*/
public Rectangle2D getStringBounds(String str, FontRenderContext frc) {
@@ -1044,46 +1087,48 @@ public class Font implements Serializable {
}
/**
- * Gets the logical bounds of the specified String in
- * the specified FontRenderContext. The logical bounds contains
- * the origin, ascent, advance, and height.
- *
- * @param str the specified String.
- * @param start the start offset.
- * @param end the end offset.
- * @param frc the FontRenderContext.
- *
+ * Gets the logical bounds of the specified String in the specified
+ * FontRenderContext. The logical bounds contains the origin, ascent,
+ * advance, and height.
+ *
+ * @param str
+ * the specified String.
+ * @param start
+ * the start offset.
+ * @param end
+ * the end offset.
+ * @param frc
+ * the FontRenderContext.
* @return a Rectangle2D object.
*/
- public Rectangle2D getStringBounds(String str, int start, int end,
- FontRenderContext frc) {
+ public Rectangle2D getStringBounds(String str, int start, int end, FontRenderContext frc) {
return this.getStringBounds((str.substring(start, end)), frc);
}
/**
- * Gets the logical bounds of the specified String in
- * the specified FontRenderContext. The logical bounds contains
- * the origin, ascent, advance, and height.
- *
- * @param chars the specified character array.
- * @param start the start offset.
- * @param end the end offset.
- * @param frc the FontRenderContext.
- *
+ * Gets the logical bounds of the specified String in the specified
+ * FontRenderContext. The logical bounds contains the origin, ascent,
+ * advance, and height.
+ *
+ * @param chars
+ * the specified character array.
+ * @param start
+ * the start offset.
+ * @param end
+ * the end offset.
+ * @param frc
+ * the FontRenderContext.
* @return a Rectangle2D object.
*/
- public Rectangle2D getStringBounds(char[] chars, int start, int end,
- FontRenderContext frc) {
+ public Rectangle2D getStringBounds(char[] chars, int start, int end, FontRenderContext frc) {
if (start < 0) {
// awt.95=Wrong start index: {0}
- throw new IndexOutOfBoundsException(Messages.getString(
- "awt.95", start)); //$NON-NLS-1$
+ throw new IndexOutOfBoundsException(Messages.getString("awt.95", start)); //$NON-NLS-1$
}
if (end > chars.length) {
// awt.96=Wrong finish index: {0}
- throw new IndexOutOfBoundsException(Messages.getString(
- "awt.96", end)); //$NON-NLS-1$
+ throw new IndexOutOfBoundsException(Messages.getString("awt.96", end)); //$NON-NLS-1$
}
if (start > end) {
// awt.97=Wrong range length: {0}
@@ -1095,7 +1140,7 @@ public class Font implements Serializable {
throw new NullPointerException(Messages.getString("awt.00")); //$NON-NLS-1$
}
- FontPeerImpl peer = (FontPeerImpl) this.getPeer();
+ FontPeerImpl peer = (FontPeerImpl)this.getPeer();
final int TRANSFORM_MASK = AffineTransform.TYPE_GENERAL_ROTATION
| AffineTransform.TYPE_GENERAL_TRANSFORM;
@@ -1110,13 +1155,13 @@ public class Font implements Serializable {
for (int i = start; i < end; i++) {
width += peer.charWidth(chars[i]);
}
- //LineMetrics nlm = peer.getLineMetrics();
-
+ // LineMetrics nlm = peer.getLineMetrics();
+
LineMetrics nlm = getLineMetrics(chars, start, end, frc);
-
+
bounds = transform.createTransformedShape(
- new Rectangle2D.Float(0, -nlm.getAscent(), width, nlm
- .getHeight())).getBounds2D();
+ new Rectangle2D.Float(0, -nlm.getAscent(), width, nlm.getHeight()))
+ .getBounds2D();
} else {
int len = end - start;
char[] subChars = new char[len];
@@ -1127,11 +1172,11 @@ public class Font implements Serializable {
}
/**
- * Gets the character's maximum bounds as defined in
- * the specified FontRenderContext.
- *
- * @param frc the FontRenderContext.
+ * Gets the character's maximum bounds as defined in the specified
+ * FontRenderContext.
*
+ * @param frc
+ * the FontRenderContext.
* @return the character's maximum bounds.
*/
public Rectangle2D getMaxCharBounds(FontRenderContext frc) {
@@ -1140,7 +1185,7 @@ public class Font implements Serializable {
throw new NullPointerException(Messages.getString("awt.00")); //$NON-NLS-1$
}
- FontPeerImpl peer = (FontPeerImpl) this.getPeer();
+ FontPeerImpl peer = (FontPeerImpl)this.getPeer();
Rectangle2D bounds = peer.getMaxCharBounds(frc);
AffineTransform transform = getTransform();
@@ -1155,42 +1200,40 @@ public class Font implements Serializable {
}
/**
- * Returns a new GlyphVector object performing full layout of
- * the text.
- *
- * @param frc the FontRenderContext.
- * @param chars the character array to be layout.
- * @param start the start offset of the text to use for
- * the GlyphVector.
- * @param count the count of characters to use for
- * the GlyphVector.
- * @param flags the flag indicating text direction:
- * LAYOUT_RIGHT_TO_LEFT, LAYOUT_LEFT_TO_RIGHT.
- *
+ * Returns a new GlyphVector object performing full layout of the text.
+ *
+ * @param frc
+ * the FontRenderContext.
+ * @param chars
+ * the character array to be layout.
+ * @param start
+ * the start offset of the text to use for the GlyphVector.
+ * @param count
+ * the count of characters to use for the GlyphVector.
+ * @param flags
+ * the flag indicating text direction: LAYOUT_RIGHT_TO_LEFT,
+ * LAYOUT_LEFT_TO_RIGHT.
* @return the GlyphVector.
*/
- public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] chars,
- int start, int count, int flags) {
+ public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] chars, int start, int count,
+ int flags) {
// TODO: implement method for bidirectional text.
// At the moment only LTR and RTL texts supported.
if (start < 0) {
// awt.95=Wrong start index: {0}
- throw new ArrayIndexOutOfBoundsException(Messages.getString(
- "awt.95", //$NON-NLS-1$
+ throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.95", //$NON-NLS-1$
start));
}
if (count < 0) {
// awt.98=Wrong count value, can not be negative: {0}
- throw new ArrayIndexOutOfBoundsException(Messages.getString(
- "awt.98", //$NON-NLS-1$
+ throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.98", //$NON-NLS-1$
count));
}
if (start + count > chars.length) {
// awt.99=Wrong [start + count] is out of range: {0}
- throw new ArrayIndexOutOfBoundsException(Messages.getString(
- "awt.99", //$NON-NLS-1$
+ throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.99", //$NON-NLS-1$
(start + count)));
}
@@ -1234,7 +1277,7 @@ public class Font implements Serializable {
* @return the postscript name of this Font.
*/
public String getPSName() {
- FontPeerImpl peer = (FontPeerImpl) this.getPeer();
+ FontPeerImpl peer = (FontPeerImpl)this.getPeer();
return peer.getPSName();
}
@@ -1251,39 +1294,37 @@ public class Font implements Serializable {
* Gets the peer of this Font.
*
* @return the peer of this Font.
- *
* @deprecated Font rendering is platform independent now.
*/
@Deprecated
public java.awt.peer.FontPeer getPeer() {
if (fontPeer == null) {
- fontPeer = (FontPeerImpl) Toolkit.getDefaultToolkit()
- .getGraphicsFactory().getFontPeer(this);
+ fontPeer = (FontPeerImpl)Toolkit.getDefaultToolkit().getGraphicsFactory().getFontPeer(
+ this);
}
return fontPeer;
}
/**
- * Gets the transform acting on this Font (from the Font's
- * attributes).
+ * Gets the transform acting on this Font (from the Font's attributes).
*
- * @return the transformation of this Font.
+ * @return the transformation of this Font.
*/
public AffineTransform getTransform() {
Object transform = fRequestedAttributes.get(TextAttribute.TRANSFORM);
if (transform != null) {
if (transform instanceof TransformAttribute) {
- return ((TransformAttribute) transform).getTransform();
+ return ((TransformAttribute)transform).getTransform();
}
if (transform instanceof AffineTransform) {
- return new AffineTransform((AffineTransform) transform);
+ return new AffineTransform((AffineTransform)transform);
}
} else {
transform = new AffineTransform();
}
- return (AffineTransform) transform;
+ return (AffineTransform)transform;
}
@@ -1324,13 +1365,12 @@ public class Font implements Serializable {
}
/**
- * Returns true if this Font has uniform line metrics.
+ * Returns true if this Font has uniform line metrics.
*
- * @return true if this Font has uniform line metrics,
- * false otherwise.
+ * @return true if this Font has uniform line metrics, false otherwise.
*/
public boolean hasUniformLineMetrics() {
- FontPeerImpl peer = (FontPeerImpl) this.getPeer();
+ FontPeerImpl peer = (FontPeerImpl)this.getPeer();
return peer.hasUniformLineMetrics();
}
@@ -1338,7 +1378,6 @@ public class Font implements Serializable {
* Returns hash code of this Font object.
*
* @return the hash code of this Font object.
-
*/
@Override
public int hashCode() {
@@ -1376,21 +1415,21 @@ public class Font implements Serializable {
*/
public int getNumGlyphs() {
if (numGlyphs == -1) {
- FontPeerImpl peer = (FontPeerImpl) this.getPeer();
+ FontPeerImpl peer = (FontPeerImpl)this.getPeer();
this.numGlyphs = peer.getNumGlyphs();
}
return this.numGlyphs;
}
/**
- * Gets the glyphCode which is used as default glyph when this Font
- * does not have a glyph for a specified unicode.
+ * Gets the glyphCode which is used as default glyph when this Font does not
+ * have a glyph for a specified Unicode.
*
* @return the missing glyph code.
*/
public int getMissingGlyphCode() {
if (missingGlyphCode == -1) {
- FontPeerImpl peer = (FontPeerImpl) this.getPeer();
+ FontPeerImpl peer = (FontPeerImpl)this.getPeer();
this.missingGlyphCode = peer.getMissingGlyphCode();
}
return this.missingGlyphCode;
@@ -1407,29 +1446,30 @@ public class Font implements Serializable {
/**
* Gets the italic angle of this Font.
- *
+ *
* @return the italic angle of this Font.
*/
public float getItalicAngle() {
- FontPeerImpl peer = (FontPeerImpl) this.getPeer();
+ FontPeerImpl peer = (FontPeerImpl)this.getPeer();
return peer.getItalicAngle();
}
/**
* Creates the font with the specified font format and font file.
*
- * @param fontFormat the font format.
- * @param fontFile the file object represented the input data
- * for the font.
- *
+ * @param fontFormat
+ * the font format.
+ * @param fontFile
+ * the file object represented the input data for the font.
* @return the Font.
- *
- * @throws FontFormatException is thrown if fontFile does not contain
- * the required font tables for the specified format.
- * @throws IOException signals that an I/O exception has occurred.
- */
- public static Font createFont(int fontFormat, File fontFile)
- throws FontFormatException, IOException {
+ * @throws FontFormatException
+ * is thrown if fontFile does not contain the required font
+ * tables for the specified format.
+ * @throws IOException
+ * signals that an I/O exception has occurred.
+ */
+ public static Font createFont(int fontFormat, File fontFile) throws FontFormatException,
+ IOException {
// ???AWT not supported
InputStream is = new FileInputStream(fontFile);
try {
@@ -1442,15 +1482,16 @@ public class Font implements Serializable {
/**
* Creates the font with the specified font format and input stream.
*
- * @param fontFormat the font format.
- * @param fontStream the input stream represented input data for
- * the font.
- *
+ * @param fontFormat
+ * the font format.
+ * @param fontStream
+ * the input stream represented input data for the font.
* @return the Font.
- *
- * @throws FontFormatException is thrown if fontFile does not contain
- * the required font tables for the specified format.
- * @throws IOException signals that an I/O exception has occurred.
+ * @throws FontFormatException
+ * is thrown if fontFile does not contain the required font
+ * tables for the specified format.
+ * @throws IOException
+ * signals that an I/O exception has occurred.
*/
public static Font createFont(int fontFormat, InputStream fontStream)
throws FontFormatException, IOException {
@@ -1466,15 +1507,15 @@ public class Font implements Serializable {
if (fontFormat != TRUETYPE_FONT) { // awt.9A=Unsupported font format
throw new IllegalArgumentException(Messages.getString("awt.9A")); //$NON-NLS-1$
}
-
+
/* Get font file in system-specific directory */
- File fontFile = Toolkit.getDefaultToolkit().getGraphicsFactory()
- .getFontManager().getTempFontFile();
+ File fontFile = Toolkit.getDefaultToolkit().getGraphicsFactory().getFontManager()
+ .getTempFontFile();
- // BEGIN android-modified
+ // BEGIN android-modified
buffStream = new BufferedInputStream(fontStream, 8192);
- // END android-modified
+ // END android-modified
FileOutputStream fOutStream = new FileOutputStream(fontFile);
bRead = buffStream.read(buf, 0, size);
diff --git a/awt/java/awt/FontFormatException.java b/awt/java/awt/FontFormatException.java
index c017fd24a53a3b93dd9e0882939cbdae42085df2..806711a76429def80ea7d6f619861479d848f433 100644
--- a/awt/java/awt/FontFormatException.java
+++ b/awt/java/awt/FontFormatException.java
@@ -18,21 +18,27 @@
* @author Ilya S. Okomin
* @version $Revision$
*/
+
package java.awt;
/**
- * The FontFormatException class is used to provide notification
- * and information that font can't be created.
+ * The FontFormatException class is used to provide notification and information
+ * that font can't be created.
+ *
+ * @since Android 1.0
*/
public class FontFormatException extends Exception {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -4481290147811361272L;
/**
* Instantiates a new font format exception with detailed message.
*
- * @param reason the detailed message.
+ * @param reason
+ * the detailed message.
*/
public FontFormatException(String reason) {
super(reason);
diff --git a/awt/java/awt/FontMetrics.java b/awt/java/awt/FontMetrics.java
index 3948d736abeadc12d66c28d3587edb398d098033..90826265a7f15262f128e52d873a57702413593b 100644
--- a/awt/java/awt/FontMetrics.java
+++ b/awt/java/awt/FontMetrics.java
@@ -18,6 +18,7 @@
* @author Ilya S. Okomin
* @version $Revision$
*/
+
package java.awt;
import java.awt.font.FontRenderContext;
@@ -29,34 +30,40 @@ import java.text.CharacterIterator;
import org.apache.harmony.awt.internal.nls.Messages;
/**
- * The FontMetrics class contains information about the rendering
- * of a particular font on a particular screen.
+ * The FontMetrics class contains information about the rendering of a
+ * particular font on a particular screen.
*
- * Each character in the Font has three values that help define where
- * to place it: an ascent, a descent, and an advance. The ascent is the
- * distance the character extends above the baseline. The descent is
- * the distance the character extends below the baseline.
- * The advance width defines the position at which the next character
- * should be placed.
+ * Each character in the Font has three values that help define where to place
+ * it: an ascent, a descent, and an advance. The ascent is the distance the
+ * character extends above the baseline. The descent is the distance the
+ * character extends below the baseline. The advance width defines the position
+ * at which the next character should be placed.
*
- * An array of characters or a string has an ascent, a descent,
- * and an advance width too. The ascent or descent of the array
- * is specified by the maximum ascent or descent of the characters
- * in the array. The advance width is the sum of the advance widths
- * of each of the characters in the character array.
+ * An array of characters or a string has an ascent, a descent, and an advance
+ * width too. The ascent or descent of the array is specified by the maximum
+ * ascent or descent of the characters in the array. The advance width is the
+ * sum of the advance widths of each of the characters in the character array.
+ *
+ *
+ * @since Android 1.0
*/
public abstract class FontMetrics implements Serializable {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = 1681126225205050147L;
- /** The font from which the FontMetrics is created. */
+ /**
+ * The font from which the FontMetrics is created.
+ */
protected Font font;
/**
* Instantiates a new font metrics from the specified Font.
*
- * @param fnt the Font.
+ * @param fnt
+ * the Font.
*/
protected FontMetrics(Font fnt) {
this.font = fnt;
@@ -65,12 +72,11 @@ public abstract class FontMetrics implements Serializable {
/**
* Returns the String representation of this FontMetrics.
*
- * @return the string
+ * @return the string.
*/
@Override
public String toString() {
- return this.getClass().getName() +
- "[font=" + this.getFont() + //$NON-NLS-1$
+ return this.getClass().getName() + "[font=" + this.getFont() + //$NON-NLS-1$
"ascent=" + this.getAscent() + //$NON-NLS-1$
", descent=" + this.getDescent() + //$NON-NLS-1$
", height=" + this.getHeight() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
@@ -95,9 +101,9 @@ public abstract class FontMetrics implements Serializable {
}
/**
- * Gets the font ascent of the Font associated with this FontMetrics.
- * The font ascent is the distance from the font's baseline to
- * the top of most alphanumeric characters.
+ * Gets the font ascent of the Font associated with this FontMetrics. The
+ * font ascent is the distance from the font's baseline to the top of most
+ * alphanumeric characters.
*
* @return the ascent of the Font associated with this FontMetrics.
*/
@@ -106,9 +112,9 @@ public abstract class FontMetrics implements Serializable {
}
/**
- * Gets the font descent of the Font associated with this FontMetrics.
- * The font descent is the distance from the font's baseline to
- * the bottom of most alphanumeric characters with descenders.
+ * Gets the font descent of the Font associated with this FontMetrics. The
+ * font descent is the distance from the font's baseline to the bottom of
+ * most alphanumeric characters with descenders.
*
* @return the descent of the Font associated with this FontMetrics.
*/
@@ -126,192 +132,198 @@ public abstract class FontMetrics implements Serializable {
}
/**
- * Gets the LineMetrics object for the specified CharacterIterator
- * in the specified Graphics.
- *
- * @param ci the CharacterIterator.
- * @param beginIndex the offset.
- * @param limit the number of characters to be used.
- * @param context the Graphics.
- *
- * @return the LineMetrics object for the specified CharacterIterator
- * in the specified Graphics.
+ * Gets the LineMetrics object for the specified CharacterIterator in the
+ * specified Graphics.
+ *
+ * @param ci
+ * the CharacterIterator.
+ * @param beginIndex
+ * the offset.
+ * @param limit
+ * the number of characters to be used.
+ * @param context
+ * the Graphics.
+ * @return the LineMetrics object for the specified CharacterIterator in the
+ * specified Graphics.
*/
- public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex,
- int limit, Graphics context) {
- return font.getLineMetrics(ci, beginIndex, limit,
- this.getFRCFromGraphics(context));
+ public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex, int limit,
+ Graphics context) {
+ return font.getLineMetrics(ci, beginIndex, limit, this.getFRCFromGraphics(context));
}
/**
- * Gets the LineMetrics object for the specified String
- * in the specified Graphics.
- *
- * @param str the String.
- * @param context the Graphics.
- *
- * @return the LineMetrics object for the specified String
- * in the specified Graphics.
+ * Gets the LineMetrics object for the specified String in the specified
+ * Graphics.
+ *
+ * @param str
+ * the String.
+ * @param context
+ * the Graphics.
+ * @return the LineMetrics object for the specified String in the specified
+ * Graphics.
*/
public LineMetrics getLineMetrics(String str, Graphics context) {
return font.getLineMetrics(str, this.getFRCFromGraphics(context));
}
/**
- * Gets the LineMetrics object for the specified character
- * array in the specified Graphics.
- *
- * @param chars the character array.
- * @param beginIndex the offset of array.
- * @param limit the number of characters to be used.
- * @param context the Graphics.
- *
- * @return the LineMetrics object for the specified character
- * array in the specified Graphics.
+ * Gets the LineMetrics object for the specified character array in the
+ * specified Graphics.
+ *
+ * @param chars
+ * the character array.
+ * @param beginIndex
+ * the offset of array.
+ * @param limit
+ * the number of characters to be used.
+ * @param context
+ * the Graphics.
+ * @return the LineMetrics object for the specified character array in the
+ * specified Graphics.
*/
- public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit,
- Graphics context) {
- return font.getLineMetrics(chars, beginIndex, limit,
- this.getFRCFromGraphics(context));
+ public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit, Graphics context) {
+ return font.getLineMetrics(chars, beginIndex, limit, this.getFRCFromGraphics(context));
}
/**
- * Gets the LineMetrics object for the specified String
- * in the specified Graphics.
- *
- * @param str the String.
- * @param beginIndex the offset.
- * @param limit the number of characters to be used.
- * @param context the Graphics.
- *
- * @return the LineMetrics object for the specified String
- * in the specified Graphics.
+ * Gets the LineMetrics object for the specified String in the specified
+ * Graphics.
+ *
+ * @param str
+ * the String.
+ * @param beginIndex
+ * the offset.
+ * @param limit
+ * the number of characters to be used.
+ * @param context
+ * the Graphics.
+ * @return the LineMetrics object for the specified String in the specified
+ * Graphics.
*/
- public LineMetrics getLineMetrics(String str, int beginIndex, int limit,
- Graphics context) {
- return font.getLineMetrics(str, beginIndex, limit,
- this.getFRCFromGraphics(context));
+ public LineMetrics getLineMetrics(String str, int beginIndex, int limit, Graphics context) {
+ return font.getLineMetrics(str, beginIndex, limit, this.getFRCFromGraphics(context));
}
/**
- * Returns the character's maximum bounds in the specified
- * Graphics context.
- *
- * @param context the Graphics context.
+ * Returns the character's maximum bounds in the specified Graphics context.
*
- * @return the character's maximum bounds in the specified
- * Graphics context.
+ * @param context
+ * the Graphics context.
+ * @return the character's maximum bounds in the specified Graphics context.
*/
public Rectangle2D getMaxCharBounds(Graphics context) {
return this.font.getMaxCharBounds(this.getFRCFromGraphics(context));
}
-
+
/**
- * Gets the bounds of the specified CharacterIterator
- * in the specified Graphics context.
- *
- * @param ci the CharacterIterator.
- * @param beginIndex the begin offset of the array.
- * @param limit the number of characters.
- * @param context the Graphics.
+ * Gets the bounds of the specified CharacterIterator in the specified
+ * Graphics context.
*
- * @return the bounds of the specified CharacterIterator
- * in the specified Graphics context.
+ * @param ci
+ * the CharacterIterator.
+ * @param beginIndex
+ * the begin offset of the array.
+ * @param limit
+ * the number of characters.
+ * @param context
+ * the Graphics.
+ * @return the bounds of the specified CharacterIterator in the specified
+ * Graphics context.
*/
- public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex,
- int limit, Graphics context) {
- return font.getStringBounds(ci, beginIndex, limit,
- this.getFRCFromGraphics(context));
+ public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex, int limit,
+ Graphics context) {
+ return font.getStringBounds(ci, beginIndex, limit, this.getFRCFromGraphics(context));
}
/**
- * Gets the bounds of the specified String
- * in the specified Graphics context.
- *
- * @param str the String.
- * @param beginIndex the begin offset of the array.
- * @param limit the number of characters.
- * @param context the Graphics.
- *
- * @return the bounds of the specified String
- * in the specified Graphics context.
+ * Gets the bounds of the specified String in the specified Graphics
+ * context.
+ *
+ * @param str
+ * the String.
+ * @param beginIndex
+ * the begin offset of the array.
+ * @param limit
+ * the number of characters.
+ * @param context
+ * the Graphics.
+ * @return the bounds of the specified String in the specified Graphics
+ * context.
*/
- public Rectangle2D getStringBounds(String str, int beginIndex, int limit,
- Graphics context) {
- return font.getStringBounds(str, beginIndex, limit,
- this.getFRCFromGraphics(context));
+ public Rectangle2D getStringBounds(String str, int beginIndex, int limit, Graphics context) {
+ return font.getStringBounds(str, beginIndex, limit, this.getFRCFromGraphics(context));
}
-
/**
- * Gets the bounds of the specified characters array
- * in the specified Graphics context.
- *
- * @param chars the characters array.
- * @param beginIndex the begin offset of the array.
- * @param limit the number of characters.
- * @param context the Graphics.
+ * Gets the bounds of the specified characters array in the specified
+ * Graphics context.
*
- * @return the bounds of the specified characters array
- * in the specified Graphics context.
+ * @param chars
+ * the characters array.
+ * @param beginIndex
+ * the begin offset of the array.
+ * @param limit
+ * the number of characters.
+ * @param context
+ * the Graphics.
+ * @return the bounds of the specified characters array in the specified
+ * Graphics context.
*/
- public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit,
- Graphics context) {
- return font.getStringBounds(chars, beginIndex, limit,
- this.getFRCFromGraphics(context));
+ public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit, Graphics context) {
+ return font.getStringBounds(chars, beginIndex, limit, this.getFRCFromGraphics(context));
}
/**
- * Gets the bounds of the specified String
- * in the specified Graphics context.
- *
- * @param str the String.
- * @param context the Graphics.
- *
- * @return the bounds of the specified String
- * in the specified Graphics context.
+ * Gets the bounds of the specified String in the specified Graphics
+ * context.
+ *
+ * @param str
+ * the String.
+ * @param context
+ * the Graphics.
+ * @return the bounds of the specified String in the specified Graphics
+ * context.
*/
public Rectangle2D getStringBounds(String str, Graphics context) {
return font.getStringBounds(str, this.getFRCFromGraphics(context));
}
/**
- * Checks if the Font has uniform line metrics or not.
- * The Font can contain characters of other fonts for
- * covering character set. In this case the Font isn't
- * uniform.
- *
- * @return true, if the Font has uniform line metrics,
- * false otherwise.
+ * Checks if the Font has uniform line metrics or not. The Font can contain
+ * characters of other fonts for covering character set. In this case the
+ * Font isn't uniform.
+ *
+ * @return true, if the Font has uniform line metrics, false otherwise.
*/
public boolean hasUniformLineMetrics() {
return this.font.hasUniformLineMetrics();
}
/**
- * Returns the distance from the leftmost point to the rightmost
- * point on the string's baseline showing the specified array
- * of bytes in this Font.
- *
- * @param data the array of bytes to be measured.
- * @param off the start offset.
- * @param len the number of bytes to be measured.
- *
+ * Returns the distance from the leftmost point to the rightmost point on
+ * the string's baseline showing the specified array of bytes in this Font.
+ *
+ * @param data
+ * the array of bytes to be measured.
+ * @param off
+ * the start offset.
+ * @param len
+ * the number of bytes to be measured.
* @return the advance width of the array.
*/
public int bytesWidth(byte[] data, int off, int len) {
int width = 0;
- if ((off >= data.length) || (off < 0)){
+ if ((off >= data.length) || (off < 0)) {
// awt.13B=offset off is out of range
throw new IllegalArgumentException(Messages.getString("awt.13B")); //$NON-NLS-1$
}
- if ((off+len > data.length)){
+ if ((off + len > data.length)) {
// awt.13C=number of elemets len is out of range
throw new IllegalArgumentException(Messages.getString("awt.13C")); //$NON-NLS-1$
}
- for (int i = off; i < off+len; i++){
+ for (int i = off; i < off + len; i++) {
width += charWidth(data[i]);
}
@@ -319,29 +331,31 @@ public abstract class FontMetrics implements Serializable {
}
/**
- * Returns the distance from the leftmost point to the rightmost
- * point on the string's baseline showing the specified array
- * of characters in this Font.
- *
- * @param data the array of characters to be measured.
- * @param off the start offset.
- * @param len the number of bytes to be measured.
- *
+ * Returns the distance from the leftmost point to the rightmost point on
+ * the string's baseline showing the specified array of characters in this
+ * Font.
+ *
+ * @param data
+ * the array of characters to be measured.
+ * @param off
+ * the start offset.
+ * @param len
+ * the number of bytes to be measured.
* @return the advance width of the array.
*/
- public int charsWidth(char[] data, int off , int len){
+ public int charsWidth(char[] data, int off, int len) {
int width = 0;
- if ((off >= data.length) || (off < 0)){
+ if ((off >= data.length) || (off < 0)) {
// awt.13B=offset off is out of range
throw new IllegalArgumentException(Messages.getString("awt.13B")); //$NON-NLS-1$
}
- if ((off+len > data.length)){
+ if ((off + len > data.length)) {
// awt.13C=number of elemets len is out of range
throw new IllegalArgumentException(Messages.getString("awt.13C")); //$NON-NLS-1$
}
- for (int i = off; i < off+len; i++){
+ for (int i = off; i < off + len; i++) {
width += charWidth(data[i]);
}
@@ -349,12 +363,11 @@ public abstract class FontMetrics implements Serializable {
}
/**
- * Returns the distance from the leftmost point to the rightmost
- * point of the specified character in this Font.
- *
- * @param ch the specified unicode point code of
- * character to be measured.
+ * Returns the distance from the leftmost point to the rightmost point of
+ * the specified character in this Font.
*
+ * @param ch
+ * the specified Unicode point code of character to be measured.
* @return the advance width of the character.
*/
public int charWidth(int ch) {
@@ -362,11 +375,11 @@ public abstract class FontMetrics implements Serializable {
}
/**
- * Returns the distance from the leftmost point to the rightmost
- * point of the specified character in this Font.
- *
- * @param ch the specified character to be measured.
+ * Returns the distance from the leftmost point to the rightmost point of
+ * the specified character in this Font.
*
+ * @param ch
+ * the specified character to be measured.
* @return the advance width of the character.
*/
public int charWidth(char ch) {
@@ -383,11 +396,11 @@ public abstract class FontMetrics implements Serializable {
}
/**
- * Gets the maximum font ascent of the Font associated with
- * this FontMetrics.
+ * Gets the maximum font ascent of the Font associated with this
+ * FontMetrics.
*
- * @return the maximum font ascent of the Font associated with
- * this FontMetrics.
+ * @return the maximum font ascent of the Font associated with this
+ * FontMetrics.
*/
public int getMaxAscent() {
return 0;
@@ -397,7 +410,6 @@ public abstract class FontMetrics implements Serializable {
* Gets the maximum font descent of character in this Font.
*
* @return the maximum font descent of character in this Font.
- *
* @deprecated Replaced by getMaxDescent() method.
*/
@Deprecated
@@ -426,23 +438,22 @@ public abstract class FontMetrics implements Serializable {
/**
* Returns the advance width for the specified String in this Font.
*
- * @param str String to be measured.
- *
- * @return the the advance width for the specified String
- * in this Font.
+ * @param str
+ * String to be measured.
+ * @return the the advance width for the specified String in this Font.
*/
public int stringWidth(String str) {
return 0;
}
-
+
/**
- * Returns FontRenderContext instanse of the Graphics context specified.
- *
- * @param context the specified Graphics context
+ * Returns a FontRenderContext instance of the Graphics context specified.
*
+ * @param context
+ * the specified Graphics context.
* @return a FontRenderContext of the specified Graphics context.
*/
- private FontRenderContext getFRCFromGraphics(Graphics context){
+ private FontRenderContext getFRCFromGraphics(Graphics context) {
FontRenderContext frc;
if (context instanceof Graphics2D) {
frc = ((Graphics2D)context).getFontRenderContext();
@@ -453,4 +464,3 @@ public abstract class FontMetrics implements Serializable {
return frc;
}
}
-
diff --git a/awt/java/awt/GradientPaint.java b/awt/java/awt/GradientPaint.java
index 0e06528f988475557618bf440182d9affdf26ee0..3b32ef53040ecfa2f1d69dd0daae81fb3e436890 100644
--- a/awt/java/awt/GradientPaint.java
+++ b/awt/java/awt/GradientPaint.java
@@ -26,56 +26,71 @@ import org.apache.harmony.awt.internal.nls.Messages;
/**
* The GradientPaint class defines a way to fill a Shape with a linear color
- * gradient pattern.
+ * gradient pattern.
*
- * The GradientPaint's fill pattern is determined by two points and two colors,
- * plus the cyclic mode option.
- * Each of the two points is painted with its corresponding color, and on
- * the line segment connecting the two points, the color is proportionally
- * changed between the two colors. For points on the same line which are not
- * between the two specified points (outside of the connecting segment) their
- * color is determined by the cyclic mode option. If the mode is cyclic, then
- * the rest of the line repeats the color pattern of the connecting segment,
- * cycling back and forth between the two colors. If not, the mode is acyclic
- * which means that all points
- * on the line outside the connecting line segment are given the same
- * color as the closest of the two specified points.
+ * The GradientPaint's fill pattern is determined by two points and two colors,
+ * plus the cyclic mode option. Each of the two points is painted with its
+ * corresponding color, and on the line segment connecting the two points, the
+ * color is proportionally changed between the two colors. For points on the
+ * same line which are not between the two specified points (outside of the
+ * connecting segment) their color is determined by the cyclic mode option. If
+ * the mode is cyclic, then the rest of the line repeats the color pattern of
+ * the connecting segment, cycling back and forth between the two colors. If
+ * not, the mode is acyclic which means that all points on the line outside the
+ * connecting line segment are given the same color as the closest of the two
+ * specified points.
*
- * The color of points that are not on the line connecting the two
- * specified points are given by perpendicular projection: by taking
- * the set of lines perpendicular to the connecting line and for each
- * one, the whole line is colored with the same color.
+ * The color of points that are not on the line connecting the two specified
+ * points are given by perpendicular projection: by taking the set of lines
+ * perpendicular to the connecting line and for each one, the whole line is
+ * colored with the same color.
+ *
+ * @since Android 1.0
*/
public class GradientPaint implements Paint {
-
- /** The start point color. */
+
+ /**
+ * The start point color.
+ */
Color color1;
- /** The end color point. */
+ /**
+ * The end color point.
+ */
Color color2;
- /** The location of the start point. */
+ /**
+ * The location of the start point.
+ */
Point2D point1;
- /** The location of the end point. */
+ /**
+ * The location of the end point.
+ */
Point2D point2;
- /** The indicator of cycle filling. If TRUE filling
- * repeated outside points stripe, if FALSE solid color filling outside. */
+ /**
+ * The indicator of cycle filling. If TRUE filling repeated outside points
+ * stripe, if FALSE solid color filling outside.
+ */
boolean cyclic;
/**
* Instantiates a new GradientPaint with cyclic or acyclic mode.
*
- * @param point1 the first specified point.
- * @param color1 the Color of the first specified point.
- * @param point2 the second specified point.
- * @param color2 the Color of the second specified point.
- * @param cyclic the cyclic mode - true if the gradient pattern should cycle
- * repeatedly between the two colors; false otherwise.
- */
- public GradientPaint(Point2D point1, Color color1, Point2D point2,
- Color color2, boolean cyclic) {
+ * @param point1
+ * the first specified point.
+ * @param color1
+ * the Color of the first specified point.
+ * @param point2
+ * the second specified point.
+ * @param color2
+ * the Color of the second specified point.
+ * @param cyclic
+ * the cyclic mode - true if the gradient pattern should cycle
+ * repeatedly between the two colors; false otherwise.
+ */
+ public GradientPaint(Point2D point1, Color color1, Point2D point2, Color color2, boolean cyclic) {
if (point1 == null || point2 == null) {
// awt.6D=Point is null
throw new NullPointerException(Messages.getString("awt.6D")); //$NON-NLS-1$
@@ -93,17 +108,24 @@ public class GradientPaint implements Paint {
}
/**
- * Instantiates a new GradientPaint with cyclic or acyclic mode;
- * points are specified by coordinates.
+ * Instantiates a new GradientPaint with cyclic or acyclic mode; points are
+ * specified by coordinates.
*
- * @param x1 the X coordinate of the first point.
- * @param y1 the Y coordinate of the first point.
- * @param color1 the color of the first point.
- * @param x2 the X coordinate of the second point.
- * @param y2 the Y coordinate of the second point.
- * @param color2 the color of the second point.
- * @param cyclic the cyclic mode - true if the gradient pattern should cycle
- * repeatedly between the two colors; false otherwise.
+ * @param x1
+ * the X coordinate of the first point.
+ * @param y1
+ * the Y coordinate of the first point.
+ * @param color1
+ * the color of the first point.
+ * @param x2
+ * the X coordinate of the second point.
+ * @param y2
+ * the Y coordinate of the second point.
+ * @param color2
+ * the color of the second point.
+ * @param cyclic
+ * the cyclic mode - true if the gradient pattern should cycle
+ * repeatedly between the two colors; false otherwise.
*/
public GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2,
boolean cyclic) {
@@ -111,15 +133,21 @@ public class GradientPaint implements Paint {
}
/**
- * Instantiates a new acyclic GradientPaint;
- * points are specified by coordinates.
+ * Instantiates a new acyclic GradientPaint; points are specified by
+ * coordinates.
*
- * @param x1 the X coordinate of the first point.
- * @param y1 the Y coordinate of the first point.
- * @param color1 the color of the first point.
- * @param x2 the X coordinate of the second point.
- * @param y2 the Y coordinate of the second point.
- * @param color2 the color of the second point.
+ * @param x1
+ * the X coordinate of the first point.
+ * @param y1
+ * the Y coordinate of the first point.
+ * @param color1
+ * the color of the first point.
+ * @param x2
+ * the X coordinate of the second point.
+ * @param y2
+ * the Y coordinate of the second point.
+ * @param color2
+ * the color of the second point.
*/
public GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2) {
this(x1, y1, color1, x2, y2, color2, false);
@@ -128,29 +156,38 @@ public class GradientPaint implements Paint {
/**
* Instantiates a new acyclic GradientPaint.
*
- * @param point1 the first specified point.
- * @param color1 the Color of the first specified point.
- * @param point2 the second specified point.
- * @param color2 the Color of the second specified point.
+ * @param point1
+ * the first specified point.
+ * @param color1
+ * the Color of the first specified point.
+ * @param point2
+ * the second specified point.
+ * @param color2
+ * the Color of the second specified point.
*/
public GradientPaint(Point2D point1, Color color1, Point2D point2, Color color2) {
this(point1, color1, point2, color2, false);
}
/**
- * Creates PaintContext for a color pattern generating.
- *
- * @param cm the ColorModel of the Paint data.
- * @param deviceBounds the bounding Rectangle of graphics primitives
- * being rendered in the device space.
- * @param userBounds tthe bounding Rectangle of graphics primitives
- * being rendered in the user space.
- * @param t the AffineTransform from user space into device space.
- * @param hints the RrenderingHints object.
+ * Creates PaintContext for a color pattern generating.
*
+ * @param cm
+ * the ColorModel of the Paint data.
+ * @param deviceBounds
+ * the bounding Rectangle of graphics primitives being rendered
+ * in the device space.
+ * @param userBounds
+ * the bounding Rectangle of graphics primitives being rendered
+ * in the user space.
+ * @param t
+ * the AffineTransform from user space into device space.
+ * @param hints
+ * the RrenderingHints object.
* @return the PaintContext for color pattern generating.
- *
- * @see java.awt.Paint#createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints)
+ * @see java.awt.Paint#createContext(java.awt.image.ColorModel,
+ * java.awt.Rectangle, java.awt.geom.Rectangle2D,
+ * java.awt.geom.AffineTransform, java.awt.RenderingHints)
*/
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
Rectangle2D userBounds, AffineTransform t, RenderingHints hints) {
@@ -178,7 +215,7 @@ public class GradientPaint implements Paint {
/**
* Gets the first point.
*
- * @return the Point object - the first point.
+ * @return the Point object - the first point.
*/
public Point2D getPoint1() {
return point1;
@@ -197,7 +234,6 @@ public class GradientPaint implements Paint {
* Gets the transparency mode for the GradientPaint.
*
* @return the transparency mode for the GradientPaint.
- *
* @see java.awt.Transparency#getTransparency()
*/
public int getTransparency() {
@@ -207,11 +243,11 @@ public class GradientPaint implements Paint {
}
/**
- * Returns the GradientPaint mode: true for cyclic mode, false for
- * acyclic mode.
+ * Returns the GradientPaint mode: true for cyclic mode, false for acyclic
+ * mode.
*
- * @return true if the gradient cycles repeatedly between the two colors;
- * false otherwise.
+ * @return true if the gradient cycles repeatedly between the two colors;
+ * false otherwise.
*/
public boolean isCyclic() {
return cyclic;
diff --git a/awt/java/awt/Graphics.java b/awt/java/awt/Graphics.java
index c20f6bc9e0ee7c3c44344727ddb30133366d872c..2d6e79fca4607dba40818f0ae2d9adafd6aa09db 100644
--- a/awt/java/awt/Graphics.java
+++ b/awt/java/awt/Graphics.java
@@ -18,26 +18,27 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.image.ImageObserver;
import java.text.AttributedCharacterIterator;
/**
- * The abstract Graphics class allows applications to draw on a screen
- * or other rendering target. There are several properties which
- * define rendering options: origin point, clipping area, color, font.
- *
- * The origin point specifies the beggining of the clipping area coordinate
- * system. All coordinates used in rendering operations are computed with
- * respect to this point. The clipping area defines the boundaries where
- * rendering operations can be performed. Rendering operations can't modify
- * pixels outside of the clipping area.
- *
- * The draw and fill methods allow applications to drawing shapes, text,
- * images with specified font and color options in the specified part
- * of the screen.
- *
+ * The abstract Graphics class allows applications to draw on a screen or other
+ * rendering target. There are several properties which define rendering
+ * options: origin point, clipping area, color, font.
+ *
+ * The origin point specifies the beginning of the clipping area coordinate
+ * system. All coordinates used in rendering operations are computed with
+ * respect to this point. The clipping area defines the boundaries where
+ * rendering operations can be performed. Rendering operations can't modify
+ * pixels outside of the clipping area.
+ *
+ * The draw and fill methods allow applications to drawing shapes, text, images
+ * with specified font and color options in the specified part of the screen.
+ *
+ * @since Android 1.0
*/
public abstract class Graphics {
@@ -45,7 +46,7 @@ public abstract class Graphics {
/**
* Instantiates a new Graphics. This constructor is default for Graphics and
- * can not be called directly.
+ * can not be called directly.
*/
protected Graphics() {
}
@@ -53,19 +54,22 @@ public abstract class Graphics {
// Public methods
/**
- * Creates a copy of the Graphics object with a new origin and a new
- * specified clip area. The new clip area is the rectangle defined by
- * the origin point with coordinates X,Y and the given width and height.
- * The coordinates of all subsequent rendering operations will be computed
- * with respect to the new origin and can be performed only within the
- * range of the clipping area dimentions.
- *
- * @param x the X coordinate of the original point
- * @param y the Y coordinate of the original point
- * @param width the width of clipping area
- * @param height the height of clipping area
+ * Creates a copy of the Graphics object with a new origin and a new
+ * specified clip area. The new clip area is the rectangle defined by the
+ * origin point with coordinates X,Y and the given width and height. The
+ * coordinates of all subsequent rendering operations will be computed with
+ * respect to the new origin and can be performed only within the range of
+ * the clipping area dimensions.
*
- * @return the Graphics object with new origin point and clipping area.
+ * @param x
+ * the X coordinate of the original point.
+ * @param y
+ * the Y coordinate of the original point.
+ * @param width
+ * the width of clipping area.
+ * @param height
+ * the height of clipping area.
+ * @return the Graphics object with new origin point and clipping area.
*/
public Graphics create(int x, int y, int width, int height) {
Graphics res = create();
@@ -75,18 +79,24 @@ public abstract class Graphics {
}
/**
- * Draws the higlighted outline of a rectangle.
+ * Draws the highlighted outline of a rectangle.
*
- * @param x the X coordinate of the rectangle's top left corner.
- * @param y the Y coordinate of the rectangle's top left corner.
- * @param width the width of rectangle.
- * @param height the height of rectangle.
- * @param raised a boolean value that determines whether the rectangle
- * is drawn as raised or indented.
+ * @param x
+ * the X coordinate of the rectangle's top left corner.
+ * @param y
+ * the Y coordinate of the rectangle's top left corner.
+ * @param width
+ * the width of rectangle.
+ * @param height
+ * the height of rectangle.
+ * @param raised
+ * a boolean value that determines whether the rectangle is drawn
+ * as raised or indented.
*/
public void draw3DRect(int x, int y, int width, int height, boolean raised) {
// Note: lighter/darker colors should be used to draw 3d rect.
- // The resulting rect is (width+1)x(height+1). Stroke and paint attributes of
+ // The resulting rect is (width+1)x(height+1). Stroke and paint
+ // attributes of
// the Graphics2D should be reset to the default values.
// fillRect is used instead of drawLine to bypass stroke
// reset/set and rasterization.
@@ -103,36 +113,46 @@ public abstract class Graphics {
setColor(colorUp);
fillRect(x, y, width, 1);
- fillRect(x, y+1, 1, height);
+ fillRect(x, y + 1, 1, height);
setColor(colorDown);
- fillRect(x+width, y, 1, height);
- fillRect(x+1, y+height, width, 1);
+ fillRect(x + width, y, 1, height);
+ fillRect(x + 1, y + height, width, 1);
}
/**
- * Draws the text represented by byte array. This method uses the current
+ * Draws the text represented by byte array. This method uses the current
* font and color for rendering.
*
- * @param bytes the byte array which contains the text to be drawn.
- * @param off the offset within the byte array of the text to be drawn.
- * @param len the number of bytes of text to draw.
- * @param x the X coordinate where the text is to be drawn.
- * @param y the Y coordinate where the text is to be drawn.
+ * @param bytes
+ * the byte array which contains the text to be drawn.
+ * @param off
+ * the offset within the byte array of the text to be drawn.
+ * @param len
+ * the number of bytes of text to draw.
+ * @param x
+ * the X coordinate where the text is to be drawn.
+ * @param y
+ * the Y coordinate where the text is to be drawn.
*/
public void drawBytes(byte[] bytes, int off, int len, int x, int y) {
drawString(new String(bytes, off, len), x, y);
}
/**
- * Draws the text represented by character array. This method uses the
+ * Draws the text represented by character array. This method uses the
* current font and color for rendering.
*
- * @param chars the character array.
- * @param off the offset within the character array of the text to be drawn.
- * @param len the number of characters which will be drawn.
- * @param x the X coordinate where the text is to be drawn.
- * @param y the Y coordinate where the text is to be drawn.
+ * @param chars
+ * the character array.
+ * @param off
+ * the offset within the character array of the text to be drawn.
+ * @param len
+ * the number of characters which will be drawn.
+ * @param x
+ * the X coordinate where the text is to be drawn.
+ * @param y
+ * the Y coordinate where the text is to be drawn.
*/
public void drawChars(char[] chars, int off, int len, int x, int y) {
drawString(new String(chars, off, len), x, y);
@@ -141,37 +161,51 @@ public abstract class Graphics {
/**
* Draws the outline of a polygon which is defined by Polygon object.
*
- * @param p the Polygon object.
+ * @param p
+ * the Polygon object.
*/
public void drawPolygon(Polygon p) {
drawPolygon(p.xpoints, p.ypoints, p.npoints);
}
/**
- * Draws the rectangle with the specified width and length and top left
+ * Draws the rectangle with the specified width and length and top left
* corner coordinates.
*
- * @param x the X coordinate of the rectangle's top left corner.
- * @param y the Y coordinate of the rectangle's top left corner.
- * @param width the width of the rectangle.
- * @param height the height of the rectangle.
+ * @param x
+ * the X coordinate of the rectangle's top left corner.
+ * @param y
+ * the Y coordinate of the rectangle's top left corner.
+ * @param width
+ * the width of the rectangle.
+ * @param height
+ * the height of the rectangle.
*/
public void drawRect(int x, int y, int width, int height) {
- int []xpoints = {x, x, x+width, x+width};
- int []ypoints = {y, y+height, y+height, y};
+ int[] xpoints = {
+ x, x, x + width, x + width
+ };
+ int[] ypoints = {
+ y, y + height, y + height, y
+ };
drawPolygon(xpoints, ypoints, 4);
}
/**
- * Fills the higlighted outline of a rectangle.
+ * Fills the highlighted outline of a rectangle.
*
- * @param x the X coordinate of the rectangle's top left corner.
- * @param y the Y coordinate of the rectangle's top left corner.
- * @param width the width of the rectangle.
- * @param height the height of the rectangle.
- * @param raised a boolean value that determines whether the rectangle
- * is drawn as raised or indented.
+ * @param x
+ * the X coordinate of the rectangle's top left corner.
+ * @param y
+ * the Y coordinate of the rectangle's top left corner.
+ * @param width
+ * the width of the rectangle.
+ * @param height
+ * the height of the rectangle.
+ * @param raised
+ * a boolean value that determines whether the rectangle is drawn
+ * as raised or indented.
*/
public void fill3DRect(int x, int y, int width, int height, boolean raised) {
// Note: lighter/darker colors should be used to draw 3d rect.
@@ -179,7 +213,7 @@ public abstract class Graphics {
// Stroke and paint attributes of the Graphics2D should be reset
// to the default values. fillRect is used instead of drawLine to
// bypass stroke reset/set and line rasterization.
-
+
Color color = getColor();
Color colorUp, colorDown;
if (raised) {
@@ -194,21 +228,22 @@ public abstract class Graphics {
width--;
height--;
- fillRect(x+1, y+1, width-1, height-1);
+ fillRect(x + 1, y + 1, width - 1, height - 1);
setColor(colorUp);
fillRect(x, y, width, 1);
- fillRect(x, y+1, 1, height);
+ fillRect(x, y + 1, 1, height);
setColor(colorDown);
- fillRect(x+width, y, 1, height);
- fillRect(x+1, y+height, width, 1);
+ fillRect(x + width, y, 1, height);
+ fillRect(x + 1, y + height, width, 1);
}
/**
* Fills the polygon with the current color.
*
- * @param p the Polygon object.
+ * @param p
+ * the Polygon object.
*/
public void fillPolygon(Polygon p) {
fillPolygon(p.xpoints, p.ypoints, p.npoints);
@@ -222,12 +257,12 @@ public abstract class Graphics {
}
/**
- * Gets the bounds of the current clipping area as a rectangle
- * and copies it to an existing rectangle.
- *
- * @param r a Rectangle object where the current clipping area
- * bounds are to be copied.
+ * Gets the bounds of the current clipping area as a rectangle and copies it
+ * to an existing rectangle.
*
+ * @param r
+ * a Rectangle object where the current clipping area bounds are
+ * to be copied.
* @return the bounds of the current clipping area.
*/
public Rectangle getClipBounds(Rectangle r) {
@@ -248,8 +283,7 @@ public abstract class Graphics {
/**
* Gets the bounds of the current clipping area as a rectangle.
*
- * @return a Rectangle object
- *
+ * @return a Rectangle object.
* @deprecated Use {@link #getClipBounds()}
*/
@Deprecated
@@ -258,9 +292,8 @@ public abstract class Graphics {
}
/**
- * Gets the font metrics of the current font.
- * The font metrics object contains information about the rendering
- * of a particular font.
+ * Gets the font metrics of the current font. The font metrics object
+ * contains information about the rendering of a particular font.
*
* @return the font metrics of current font.
*/
@@ -269,19 +302,23 @@ public abstract class Graphics {
}
/**
- * Determines whether or not the specified rectangle intersects the
- * current clipping area.
- *
- * @param x the X coordinate of the rectangle.
- * @param y the Y coordinate of the rectangle.
- * @param width the width of the rectangle.
- * @param height the height of the rectangle.
+ * Determines whether or not the specified rectangle intersects the current
+ * clipping area.
*
- * @return true, if the specified rectangle intersects the current clipping area,
- * overwise false.
+ * @param x
+ * the X coordinate of the rectangle.
+ * @param y
+ * the Y coordinate of the rectangle.
+ * @param width
+ * the width of the rectangle.
+ * @param height
+ * the height of the rectangle.
+ * @return true, if the specified rectangle intersects the current clipping
+ * area, false otherwise.
*/
public boolean hitClip(int x, int y, int width, int height) {
- // TODO: Create package private method Rectangle.intersects(int, int, int, int);
+ // TODO: Create package private method Rectangle.intersects(int, int,
+ // int, int);
return getClipBounds().intersects(new Rectangle(x, y, width, height));
}
@@ -299,45 +336,56 @@ public abstract class Graphics {
// Abstract methods
/**
- * Clears the specified rectangle. This method fills specified rectangle
- * with background color.
+ * Clears the specified rectangle. This method fills specified rectangle
+ * with background color.
*
- * @param x the X coordinate of the rectangle.
- * @param y the Y coordinate of the rectangle.
- * @param width the width of the rectangle.
- * @param height the height of the rectangle.
+ * @param x
+ * the X coordinate of the rectangle.
+ * @param y
+ * the Y coordinate of the rectangle.
+ * @param width
+ * the width of the rectangle.
+ * @param height
+ * the height of the rectangle.
*/
public abstract void clearRect(int x, int y, int width, int height);
/**
- * Intersects the current clipping area with a new rectangle.
- * If the current clipping area is not defined, the rectangle
- * becomes a new clipping area. Rendering operations are only allowed
- * within the new the clipping area.
- *
- * @param x the X coordinate of the rectangle for intersection.
- * @param y the Y coordinate of the rectangle for intersection.
- * @param width the width of the rectangle for intersection.
- * @param height the height of the rectangle for intersection.
+ * Intersects the current clipping area with a new rectangle. If the current
+ * clipping area is not defined, the rectangle becomes a new clipping area.
+ * Rendering operations are only allowed within the new the clipping area.
+ *
+ * @param x
+ * the X coordinate of the rectangle for intersection.
+ * @param y
+ * the Y coordinate of the rectangle for intersection.
+ * @param width
+ * the width of the rectangle for intersection.
+ * @param height
+ * the height of the rectangle for intersection.
*/
public abstract void clipRect(int x, int y, int width, int height);
/**
- * Copies the rectangle area to another area specified by
- * a distance (dx, dy) from the original rectangle's location.
- * Positive dx and dy values give a new location defined by
- * translation to the right and down from the original location,
- * negative dx and dy values - to the left and up.
- *
- *
- * @param sx the X coordinate of the rectangle which will be copied.
- * @param sy the Y coordinate of the rectangle which will be copied.
- * @param width the width of the rectangle which will be copied.
- * @param height the height of the rectangle which will be copied.
- * @param dx the horizontal distance from the source rectangle's
- * location to the copy's location.
- * @param dy the vertical distance from the source rectangle's
- * location to the copy's location.
+ * Copies the rectangle area to another area specified by a distance (dx,
+ * dy) from the original rectangle's location. Positive dx and dy values
+ * give a new location defined by translation to the right and down from the
+ * original location, negative dx and dy values - to the left and up.
+ *
+ * @param sx
+ * the X coordinate of the rectangle which will be copied.
+ * @param sy
+ * the Y coordinate of the rectangle which will be copied.
+ * @param width
+ * the width of the rectangle which will be copied.
+ * @param height
+ * the height of the rectangle which will be copied.
+ * @param dx
+ * the horizontal distance from the source rectangle's location
+ * to the copy's location.
+ * @param dy
+ * the vertical distance from the source rectangle's location to
+ * the copy's location.
*/
public abstract void copyArea(int sx, int sy, int width, int height, int dx, int dy);
@@ -349,215 +397,314 @@ public abstract class Graphics {
public abstract Graphics create();
/**
- * Disposes of the Graphics. This Graphics object can not be used after
- * calling this method.
+ * Disposes of the Graphics. This Graphics object can not be used after
+ * calling this method.
*/
public abstract void dispose();
/**
- * Draws the arc covering the specified rectangle and using the current color.
- * The rectangle is defined by the origin point (X, Y) and dimentions
- * (width and height). The arc center is the the center of specified rectangle.
- * The angle origin is 3 o'clock position, the positive angle is counted as a
- * counter-clockwise rotation, the negotive angle is counted as clockwise rotation.
- *
- * @param x the X origin coordinate of the rectangle which scales the arc.
- * @param y the Y origin coordinate of the rectangle which scales the arc.
- * @param width the width of the rectangle which scales the arc.
- * @param height the height of the rectangle which scales the arc.
- * @param sa start angle - the origin angle of arc.
- * @param ea arc angle - the angular arc value relative to the start angle.
+ * Draws the arc covering the specified rectangle and using the current
+ * color. The rectangle is defined by the origin point (X, Y) and dimensions
+ * (width and height). The arc center is the the center of specified
+ * rectangle. The angle origin is 3 o'clock position, the positive angle is
+ * counted as a counter-clockwise rotation, the negative angle is counted as
+ * clockwise rotation.
+ *
+ * @param x
+ * the X origin coordinate of the rectangle which scales the arc.
+ * @param y
+ * the Y origin coordinate of the rectangle which scales the arc.
+ * @param width
+ * the width of the rectangle which scales the arc.
+ * @param height
+ * the height of the rectangle which scales the arc.
+ * @param sa
+ * start angle - the origin angle of arc.
+ * @param ea
+ * arc angle - the angular arc value relative to the start angle.
*/
public abstract void drawArc(int x, int y, int width, int height, int sa, int ea);
/**
- * Draws the specified image with the defined background color.
- * The top left corner of image will be drawn at point (x, y)
- * in current coordinate system. The image loading process notifies the
- * specified Image Observer. This method returns true if the image
- * has loaded, overwise it returns false.
- *
- * @param img the image which will be drawn.
- * @param x the X coordinate of the image top left corner.
- * @param y the Y coordinate of the image top left corner.
- * @param bgcolor the background color.
- * @param observer the ImageObserver object which should be notified about image loading process.
- *
- * @return true, if loading image is successful or image is null, overwise false.
+ * Draws the specified image with the defined background color. The top left
+ * corner of image will be drawn at point (x, y) in current coordinate
+ * system. The image loading process notifies the specified Image Observer.
+ * This method returns true if the image has loaded, otherwise it returns
+ * false.
+ *
+ * @param img
+ * the image which will be drawn.
+ * @param x
+ * the X coordinate of the image top left corner.
+ * @param y
+ * the Y coordinate of the image top left corner.
+ * @param bgcolor
+ * the background color.
+ * @param observer
+ * the ImageObserver object which should be notified about image
+ * loading process.
+ * @return true, if loading image is successful or image is null, false
+ * otherwise.
*/
public abstract boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer);
/**
- * Draws the specified image.
- * The top left corner of image will be drawn at point (x, y)
- * in current coordinate system. The image loading process notifies the
- * specified Image Observer. This method returns true if the image
- * has loaded, overwise it returns false.
+ * Draws the specified image. The top left corner of image will be drawn at
+ * point (x, y) in current coordinate system. The image loading process
+ * notifies the specified Image Observer. This method returns true if the
+ * image has loaded, otherwise it returns false.
*
- * @param img the image which will be drawn.
- * @param x the X coordinate of the image top left corner.
- * @param y the Y coordinate of the image top left corner.
- * @param observer the ImageObserver object which should be notified about image loading process.
- *
- * @return true, if loading image is successful or image is null, overwise false.
+ * @param img
+ * the image which will be drawn.
+ * @param x
+ * the X coordinate of the image top left corner.
+ * @param y
+ * the Y coordinate of the image top left corner.
+ * @param observer
+ * the ImageObserver object which should be notified about image
+ * loading process.
+ * @return true, if loading image is successful or image is null, otherwise
+ * false.
*/
public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer);
/**
- * Scales the specified image to fit in the specified rectangle and
- * draws it with the defined background color. The top left corner
- * of the image will be drawn at the point (x, y) in current coordinate
- * system. The non-opaque pixels will be drawn in the background color.
- * The image loading process notifies the specified Image Observer.
- * This method returns true if the image has loaded, overwise it returns false.
- *
- * @param img the image which will be drawn.
- * @param x the X coordinate of the image's top left corner.
- * @param y the Y coordinate of the image's top left corner.
- * @param width the width of rectangle which scales the image.
- * @param height the height of rectangle which scales the image.
- * @param bgcolor the background color.
- * @param observer the ImageObserver object which should be notified about image loading process.
- *
- * @return true, if loading image is successful or image is null, overwise false.
- */
- public abstract boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer);
-
- /**
- * Scales the specified image to fit in the specified rectangle and
- * draws it. The top left corner of the image will be drawn at the
- * point (x, y) in current coordinate system. The image loading process
- * notifies the specified Image Observer.
- * This method returns true if the image has loaded, overwise it returns false.
- *
- * @param img the image which will be drawn.
- * @param x the X coordinate of the image top left corner.
- * @param y the Y coordinate of the image top left corner.
- * @param width the width of rectangle which scales the image.
- * @param height the height of rectangle which scales the image.
- * @param observer the ImageObserver object which should be notified about image loading process.
- *
- * @return true, if loading image is successful or image is null, overwise false.
- */
- public abstract boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer);
-
- /**
- * Scales the specified area of the specified image to fit in the rectangle area
- * defined by its corners coordinates and draws the sub-image with the specified
- * background color. The sub-image to be drawn is defined by its top left
- * corner coordinates (sx1, sy1) and bottom right corner coordinates (sx2, sy2)
- * computed with respect to the origin (top left corner) of the source image.
- * The non opaque pixels will be drawn in the background color. The
- * image loading process notifies specified Image Observer.
- * This method returns true if the image
- * has loaded, overwise it returns false.
- *
- * @param img the image which will be drawn.
- * @param dx1 the X top left corner coordinate of the destination rectangle area.
- * @param dy1 the Y top left corner coordinate of the destination rectangle area.
- * @param dx2 the X bottom right corner coordinate of the destination rectangle area.
- * @param dy2 the Y bottom right corner coordinate of the destination rectangle area.
- * @param sx1 the X top left corner coordinate of the area to be drawn within the source image.
- * @param sy1 the Y top left corner coordinate of the area to be drawn within the source image.
- * @param sx2 the X bottom right corner coordinate of the area to be drawn within the source image.
- * @param sy2 the Y bottom right corner coordinate of the area to be drawn within the source image.
- * @param bgcolor the background color.
- * @param observer the ImageObserver object which should be notified about image loading process.
- *
- * @return true, if loading image is successful or image is null, overwise false.
- */
- public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer);
-
- /**
- * Scales the specified area of the specified image to fit in the rectangle area
- * defined by its corners coordinates and draws the sub-image. The sub-image
- * to be drawn is defined by its top left
- * corner coordinates (sx1, sy1) and bottom right corner coordinates (sx2, sy2)
- * computed with respect to the origin (top left corner) of the source image.
- * The image loading process notifies specified Image Observer.
- * This method returns true if the image
- * has loaded, overwise it returns false.
- *
- * @param img the image which will be drawn.
- * @param dx1 the X top left corner coordinate of the destination rectangle area.
- * @param dy1 the Y top left corner coordinate of the destination rectangle area.
- * @param dx2 the X bottom right corner coordinate of the destination rectangle area.
- * @param dy2 the Y bottom right corner coordinate of the destination rectangle area.
- * @param sx1 the X top left corner coordinate of the area to be drawn within the source image.
- * @param sy1 the Y top left corner coordinate of the area to be drawn within the source image.
- * @param sx2 the X bottom right corner coordinate of the area to be drawn within the source image.
- * @param sy2 the Y bottom right corner coordinate of the area to be drawn within the source image.
- * @param observer the ImageObserver object which should be notified about image loading process.
- *
- * @return true, if loading image is successful or image is null, overwise false.
- */
- public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer);
-
- /**
- * Draws a line from the point (x1, y1) to the point (x2, y2).
- * This method draws the line with current color
- * which can be changed by setColor(Color c) method.
- *
- * @param x1 the X coordinate of the first point.
- * @param y1 the Y coordinate of the first point.
- * @param x2 the X coordinate of the second point.
- * @param y2 the Y coordinate of the second point.
+ * Scales the specified image to fit in the specified rectangle and draws it
+ * with the defined background color. The top left corner of the image will
+ * be drawn at the point (x, y) in current coordinate system. The non-opaque
+ * pixels will be drawn in the background color. The image loading process
+ * notifies the specified Image Observer. This method returns true if the
+ * image has loaded, otherwise it returns false.
+ *
+ * @param img
+ * the image which will be drawn.
+ * @param x
+ * the X coordinate of the image's top left corner.
+ * @param y
+ * the Y coordinate of the image's top left corner.
+ * @param width
+ * the width of rectangle which scales the image.
+ * @param height
+ * the height of rectangle which scales the image.
+ * @param bgcolor
+ * the background color.
+ * @param observer
+ * the ImageObserver object which should be notified about image
+ * loading process.
+ * @return true, if loading image is successful or image is null, otherwise
+ * false.
+ */
+ public abstract boolean drawImage(Image img, int x, int y, int width, int height,
+ Color bgcolor, ImageObserver observer);
+
+ /**
+ * Scales the specified image to fit in the specified rectangle and draws
+ * it. The top left corner of the image will be drawn at the point (x, y) in
+ * current coordinate system. The image loading process notifies the
+ * specified Image Observer. This method returns true if the image has
+ * loaded, otherwise it returns false.
+ *
+ * @param img
+ * the image which will be drawn.
+ * @param x
+ * the X coordinate of the image top left corner.
+ * @param y
+ * the Y coordinate of the image top left corner.
+ * @param width
+ * the width of rectangle which scales the image.
+ * @param height
+ * the height of rectangle which scales the image.
+ * @param observer
+ * the ImageObserver object which should be notified about image
+ * loading process.
+ * @return true, if loading image is successful or image is null, otherwise
+ * false.
+ */
+ public abstract boolean drawImage(Image img, int x, int y, int width, int height,
+ ImageObserver observer);
+
+ /**
+ * Scales the specified area of the specified image to fit in the rectangle
+ * area defined by its corners coordinates and draws the sub-image with the
+ * specified background color. The sub-image to be drawn is defined by its
+ * top left corner coordinates (sx1, sy1) and bottom right corner
+ * coordinates (sx2, sy2) computed with respect to the origin (top left
+ * corner) of the source image. The non opaque pixels will be drawn in the
+ * background color. The image loading process notifies specified Image
+ * Observer. This method returns true if the image has loaded, otherwise it
+ * returns false.
+ *
+ * @param img
+ * the image which will be drawn.
+ * @param dx1
+ * the X top left corner coordinate of the destination rectangle
+ * area.
+ * @param dy1
+ * the Y top left corner coordinate of the destination rectangle
+ * area.
+ * @param dx2
+ * the X bottom right corner coordinate of the destination
+ * rectangle area.
+ * @param dy2
+ * the Y bottom right corner coordinate of the destination
+ * rectangle area.
+ * @param sx1
+ * the X top left corner coordinate of the area to be drawn
+ * within the source image.
+ * @param sy1
+ * the Y top left corner coordinate of the area to be drawn
+ * within the source image.
+ * @param sx2
+ * the X bottom right corner coordinate of the area to be drawn
+ * within the source image.
+ * @param sy2
+ * the Y bottom right corner coordinate of the area to be drawn
+ * within the source image.
+ * @param bgcolor
+ * the background color.
+ * @param observer
+ * the ImageObserver object which should be notified about image
+ * loading process.
+ * @return true, if loading image is successful or image is null, false
+ * otherwise.
+ */
+ public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1,
+ int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer);
+
+ /**
+ * Scales the specified area of the specified image to fit in the rectangle
+ * area defined by its corners coordinates and draws the sub-image. The
+ * sub-image to be drawn is defined by its top left corner coordinates (sx1,
+ * sy1) and bottom right corner coordinates (sx2, sy2) computed with respect
+ * to the origin (top left corner) of the source image. The image loading
+ * process notifies specified Image Observer. This method returns true if
+ * the image has loaded, otherwise it returns false.
+ *
+ * @param img
+ * the image which will be drawn.
+ * @param dx1
+ * the X top left corner coordinate of the destination rectangle
+ * area.
+ * @param dy1
+ * the Y top left corner coordinate of the destination rectangle
+ * area.
+ * @param dx2
+ * the X bottom right corner coordinate of the destination
+ * rectangle area.
+ * @param dy2
+ * the Y bottom right corner coordinate of the destination
+ * rectangle area.
+ * @param sx1
+ * the X top left corner coordinate of the area to be drawn
+ * within the source image.
+ * @param sy1
+ * the Y top left corner coordinate of the area to be drawn
+ * within the source image.
+ * @param sx2
+ * the X bottom right corner coordinate of the area to be drawn
+ * within the source image.
+ * @param sy2
+ * the Y bottom right corner coordinate of the area to be drawn
+ * within the source image.
+ * @param observer
+ * the ImageObserver object which should be notified about image
+ * loading process.
+ * @return true, if loading image is successful or image is null, false
+ * otherwise.
+ */
+ public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1,
+ int sy1, int sx2, int sy2, ImageObserver observer);
+
+ /**
+ * Draws a line from the point (x1, y1) to the point (x2, y2). This method
+ * draws the line with current color which can be changed by setColor(Color
+ * c) method.
+ *
+ * @param x1
+ * the X coordinate of the first point.
+ * @param y1
+ * the Y coordinate of the first point.
+ * @param x2
+ * the X coordinate of the second point.
+ * @param y2
+ * the Y coordinate of the second point.
*/
public abstract void drawLine(int x1, int y1, int x2, int y2);
/**
- * Draws the ouline of an oval to fit in the rectangle defined
- * by the given width, height, and top left corner.
+ * Draws the outline of an oval to fit in the rectangle defined by the given
+ * width, height, and top left corner.
*
- * @param x the X top left corner oval coordinate
- * @param y the Y top left corner oval coordinate
- * @param width the oval width
- * @param height the oval height
+ * @param x
+ * the X top left corner oval coordinate.
+ * @param y
+ * the Y top left corner oval coordinate.
+ * @param width
+ * the oval width.
+ * @param height
+ * the oval height.
*/
public abstract void drawOval(int x, int y, int width, int height);
/**
- * Draws the outline of a polygon. The polygon vertices are defined by points
- * with xpoints[i], ypoints[i] as coordinates. The polygon edges are the
- * lines from the points with (xpoints[i-1], ypoints[i-1]) coordinates to
- * the points with (xpoints[i], ypoints[i]) coordinates, for 0 < i < npoints +1.
+ * Draws the outline of a polygon. The polygon vertices are defined by
+ * points with xpoints[i], ypoints[i] as coordinates. The polygon edges are
+ * the lines from the points with (xpoints[i-1], ypoints[i-1]) coordinates
+ * to the points with (xpoints[i], ypoints[i]) coordinates, for 0 < i <
+ * npoints +1.
*
- * @param xpoints the array of X coordinates of the polygon vertices.
- * @param ypoints the array of Y coordinates of the polygon vertices.
- * @param npoints the number of polygon vertices/points.
+ * @param xpoints
+ * the array of X coordinates of the polygon vertices.
+ * @param ypoints
+ * the array of Y coordinates of the polygon vertices.
+ * @param npoints
+ * the number of polygon vertices/points.
*/
public abstract void drawPolygon(int[] xpoints, int[] ypoints, int npoints);
/**
- * Draws a set of connected lines which are defined by the x and y coordinate arrays.
- * The polyline is closed if coordinates of the first point are the same as
- * coordinates of the last point.
+ * Draws a set of connected lines which are defined by the x and y
+ * coordinate arrays. The polyline is closed if coordinates of the first
+ * point are the same as coordinates of the last point.
*
- * @param xpoints the array of X point coordinates.
- * @param ypoints the array of Y point coordinates.
- * @param npoints the number of points.
+ * @param xpoints
+ * the array of X point coordinates.
+ * @param ypoints
+ * the array of Y point coordinates.
+ * @param npoints
+ * the number of points.
*/
public abstract void drawPolyline(int[] xpoints, int[] ypoints, int npoints);
/**
* Draws the outline of a rectangle with round corners.
*
- * @param x the X coordinate of the rectangle's top left corner.
- * @param y the Y coordinate of the rectangle's top left corner.
- * @param width the width of the rectangle.
- * @param height the height of the rectangle.
- * @param arcWidth the arc width for the corners.
- * @param arcHeight the arc height for the corners.
- */
- public abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
-
- /**
- * Draws a text defined by an iterator. The iterator should specify the font
- * for every character.
- *
- * @param iterator the iterator.
- * @param x the X coordinate of the firt character.
- * @param y the Y coordinate of the first character.
+ * @param x
+ * the X coordinate of the rectangle's top left corner.
+ * @param y
+ * the Y coordinate of the rectangle's top left corner.
+ * @param width
+ * the width of the rectangle.
+ * @param height
+ * the height of the rectangle.
+ * @param arcWidth
+ * the arc width for the corners.
+ * @param arcHeight
+ * the arc height for the corners.
+ */
+ public abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth,
+ int arcHeight);
+
+ /**
+ * Draws a text defined by an iterator. The iterator should specify the font
+ * for every character.
+ *
+ * @param iterator
+ * the iterator.
+ * @param x
+ * the X coordinate of the first character.
+ * @param y
+ * the Y coordinate of the first character.
*/
public abstract void drawString(AttributedCharacterIterator iterator, int x, int y);
@@ -565,86 +712,117 @@ public abstract class Graphics {
* Draws a text defined by a string. This method draws the text with current
* font and color.
*
- * @param str the string.
- * @param x the X coordinate of the firt character.
- * @param y the Y coordinate of the first character.
+ * @param str
+ * the string.
+ * @param x
+ * the X coordinate of the first character.
+ * @param y
+ * the Y coordinate of the first character.
*/
public abstract void drawString(String str, int x, int y);
/**
- * Fills the arc covering the rectangle and using the current color.
- * The rectangle is defined by the origin point (X, Y) and dimentions (width and height).
- * The arc center is the the center of specified rectangle.
- * The angle origin is at the 3 o'clock position, and a positive angle gives
+ * Fills the arc covering the rectangle and using the current color. The
+ * rectangle is defined by the origin point (X, Y) and dimensions (width and
+ * height). The arc center is the the center of specified rectangle. The
+ * angle origin is at the 3 o'clock position, and a positive angle gives
* counter-clockwise rotation, a negative angle gives clockwise rotation.
- *
- * @param x the X origin coordinate of the rectangle which scales the arc.
- * @param y the Y origin coordinate of the rectangle which scales the arc.
- * @param width the width of the rectangle which scales the arc.
- * @param height the height of the rectangle which scales the arc.
- * @param sa start angle - the origin angle of arc.
- * @param ea arc angle - the angular arc value relative to the start angle.
+ *
+ * @param x
+ * the X origin coordinate of the rectangle which scales the arc.
+ * @param y
+ * the Y origin coordinate of the rectangle which scales the arc.
+ * @param width
+ * the width of the rectangle which scales the arc.
+ * @param height
+ * the height of the rectangle which scales the arc.
+ * @param sa
+ * start angle - the origin angle of arc.
+ * @param ea
+ * arc angle - the angular arc value relative to the start angle.
*/
public abstract void fillArc(int x, int y, int width, int height, int sa, int ea);
/**
- * Fills an oval with the current color where the oval is defined by the
+ * Fills an oval with the current color where the oval is defined by the
* bounding rectangle with the given width, height, and top left corner.
*
- * @param x the X top left corner oval coordinate.
- * @param y the Y top left corner oval coordinate.
- * @param width the oval width.
- * @param height the oval height.
+ * @param x
+ * the X top left corner oval coordinate.
+ * @param y
+ * the Y top left corner oval coordinate.
+ * @param width
+ * the oval width.
+ * @param height
+ * the oval height.
*/
public abstract void fillOval(int x, int y, int width, int height);
/**
- * Fills a polygon with the current color. The polygon vertices are defined by the points
- * with xpoints[i], ypoints[i] as coordinates. The polygon edges are the
- * lines from the points with (xpoints[i-1], ypoints[i-1]) coordinates to
- * the points with (xpoints[i], ypoints[i]) coordinates, for 0 < i < npoints +1.
+ * Fills a polygon with the current color. The polygon vertices are defined
+ * by the points with xpoints[i], ypoints[i] as coordinates. The polygon
+ * edges are the lines from the points with (xpoints[i-1], ypoints[i-1])
+ * coordinates to the points with (xpoints[i], ypoints[i]) coordinates, for
+ * 0 < i < npoints +1.
*
- * @param xpoints the array of X coordinates of the polygon vertices.
- * @param ypoints the array of Y coordinates of the polygon vertices.
- * @param npoints the number of polygon vertices/points.
+ * @param xpoints
+ * the array of X coordinates of the polygon vertices.
+ * @param ypoints
+ * the array of Y coordinates of the polygon vertices.
+ * @param npoints
+ * the number of polygon vertices/points.
*/
public abstract void fillPolygon(int[] xpoints, int[] ypoints, int npoints);
/**
- * Fills a rectangle with the current color.
- * The rectangle is defined by its width and length and top left corner coordinates.
+ * Fills a rectangle with the current color. The rectangle is defined by its
+ * width and length and top left corner coordinates.
*
- * @param x the X coordinate of the rectangle's top left corner.
- * @param y the Y coordinate of the rectangle's top left corner.
- * @param width the width of rectangle.
- * @param height the height of rectangle.
+ * @param x
+ * the X coordinate of the rectangle's top left corner.
+ * @param y
+ * the Y coordinate of the rectangle's top left corner.
+ * @param width
+ * the width of rectangle.
+ * @param height
+ * the height of rectangle.
*/
public abstract void fillRect(int x, int y, int width, int height);
/**
* Fills a round cornered rectangle with the current color.
*
- * @param x the X coordinate of the top left corner of the bounding rectangle.
- * @param y the Y coordinate of the top left corner of the bounding rectangle.
- * @param width the width of the bounding rectangle.
- * @param height the height of the bounding rectangle.
- * @param arcWidth the arc width at the corners.
- * @param arcHeight the arc height at the corners.
+ * @param x
+ * the X coordinate of the top left corner of the bounding
+ * rectangle.
+ * @param y
+ * the Y coordinate of the top left corner of the bounding
+ * rectangle.
+ * @param width
+ * the width of the bounding rectangle.
+ * @param height
+ * the height of the bounding rectangle.
+ * @param arcWidth
+ * the arc width at the corners.
+ * @param arcHeight
+ * the arc height at the corners.
*/
- public abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
+ public abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth,
+ int arcHeight);
/**
- * Gets the clipping area.
- *
- *
+ * Gets the clipping area.
+ *
+ *
* @return a Shape object of the clipping area or null if it is not set.
*/
public abstract Shape getClip();
/**
* Gets the bounds of the current clipping area as a rectangle.
- *
- * @return a Rectangle object which represents the bounds of the current clipping area.
+ *
+ * @return a Rectangle object which represents the bounds of the current
+ * clipping area.
*/
public abstract Rectangle getClipBounds();
@@ -663,75 +841,84 @@ public abstract class Graphics {
public abstract Font getFont();
/**
- * Gets the font metrics of the specified font.
- * The font metrics object contains information about the rendering of a particular font.
- *
- * @param font the specified font
+ * Gets the font metrics of the specified font. The font metrics object
+ * contains information about the rendering of a particular font.
*
+ * @param font
+ * the specified font.
* @return the font metrics for the specified font.
*/
public abstract FontMetrics getFontMetrics(Font font);
/**
- * Sets the new clipping area specified by rectangle. The new clipping area
- * doesn't depend on the window's visibility. Rendering operations can't be performed
- * outside new clipping area.
+ * Sets the new clipping area specified by rectangle. The new clipping area
+ * doesn't depend on the window's visibility. Rendering operations can't be
+ * performed outside new clipping area.
*
- * @param x the X coordinate of the new clipping rectangle.
- * @param y the Y coordinate of the new clipping rectangle.
- * @param width the width of the new clipping rectangle.
- * @param height the height of the new clipping rectangle.
+ * @param x
+ * the X coordinate of the new clipping rectangle.
+ * @param y
+ * the Y coordinate of the new clipping rectangle.
+ * @param width
+ * the width of the new clipping rectangle.
+ * @param height
+ * the height of the new clipping rectangle.
*/
public abstract void setClip(int x, int y, int width, int height);
/**
- * Sets the new clipping area to be the area specified by Shape object.
- * The new clipping area doesn't depend on the window's visibility.
- * Rendering operations can't be performed outside new clipping area.
+ * Sets the new clipping area to be the area specified by Shape object. The
+ * new clipping area doesn't depend on the window's visibility. Rendering
+ * operations can't be performed outside new clipping area.
*
- * @param clip a Shape object which representes new clipping area.
+ * @param clip
+ * the Shape object which represents new clipping area.
*/
public abstract void setClip(Shape clip);
/**
- * Sets the current Graphics color. All rendering operations with this Graphics
- * will use this color.
+ * Sets the current Graphics color. All rendering operations with this
+ * Graphics will use this color.
*
- * @param c the new color.
+ * @param c
+ * the new color.
*/
public abstract void setColor(Color c);
/**
- * Sets the current Graphics font. All rendering operations with this Graphics
- * will use this font.
+ * Sets the current Graphics font. All rendering operations with this
+ * Graphics will use this font.
*
- * @param font the new font.
+ * @param font
+ * the new font.
*/
public abstract void setFont(Font font);
/**
- * Sets the paint mode for the Graphics which overwrites all rendering
+ * Sets the paint mode for the Graphics which overwrites all rendering
* operations with the current color.
- *
*/
public abstract void setPaintMode();
/**
- * Sets the XOR mode for the Graphics which changes a pixel from
- * the current color to the specified XOR color.
- *
+ * Sets the XOR mode for the Graphics which changes a pixel from the current
+ * color to the specified XOR color.
+ *
*
- * @param color the new XOR mode
+ * @param color
+ * the new XOR mode.
*/
public abstract void setXORMode(Color color);
/**
- * Translates the origin of Graphics current coordinate system
- * to the point with X, Y coordinates in the current coordinate system.
- * All rendering operation in this Graphics will be related to the new origin.
+ * Translates the origin of Graphics current coordinate system to the point
+ * with X, Y coordinates in the current coordinate system. All rendering
+ * operation in this Graphics will be related to the new origin.
*
- * @param x the X coordinate of the origin
- * @param y the Y coordinate of the origin
+ * @param x
+ * the X coordinate of the origin.
+ * @param y
+ * the Y coordinate of the origin.
*/
public abstract void translate(int x, int y);
}
diff --git a/awt/java/awt/Graphics2D.java b/awt/java/awt/Graphics2D.java
index 2ff5e0c9b90fe88979f11f9e56b72375fcca1737..04a7319de851d915cadc8b9e47a50014f15ede05 100644
--- a/awt/java/awt/Graphics2D.java
+++ b/awt/java/awt/Graphics2D.java
@@ -30,19 +30,22 @@ import java.util.Map;
/**
* The Graphics2D class extends Graphics class and provides more capabilities
- * for rendering text, images, shapes. This provides methods to peform
- * transformation of coordinate system, color management, and text layout.
- * The following attributes exist for rendering:
+ * for rendering text, images, shapes. This provides methods to perform
+ * transformation of coordinate system, color management, and text layout. The
+ * following attributes exist for rendering:
*
*
Color - current Graphics2D color;
*
Font - current Graphics2D font;
- *
Stroke - pen with a width of 1 pixel;
+ *
Stroke - pen with a width of 1 pixel;
*
Transform - current Graphics2D Transformation;
- *
Composite - alpha compositing rules for combining source and destination colors.
- *
+ *
Composite - alpha compositing rules for combining source and destination
+ * colors.
+ *
+ *
+ * @since Android 1.0
*/
public abstract class Graphics2D extends Graphics {
-
+
/**
* Instantiates a new Graphics2D object. This constructor should never be
* called directly.
@@ -52,41 +55,46 @@ public abstract class Graphics2D extends Graphics {
}
/**
- * Adds preferences for the rendering algorithms. The preferences
- * are arbitrary and specified by Map objects. All specified by Map object
- * preferencies can be modified.
+ * Adds preferences for the rendering algorithms. The preferences are
+ * arbitrary and specified by Map objects. All specified by Map object
+ * preferences can be modified.
*
- * @param hints the rendering hints.
+ * @param hints
+ * the rendering hints.
*/
public abstract void addRenderingHints(Map, ?> hints);
/**
- * Intersects the current clipping area with the specified Shape
- * and the result becomes a new clipping area.
- * If current clipping area is not defined, the Shape
- * becomes the new clipping area. No rendering operations
- * are allowed outside the clipping area.
+ * Intersects the current clipping area with the specified Shape and the
+ * result becomes a new clipping area. If current clipping area is not
+ * defined, the Shape becomes the new clipping area. No rendering operations
+ * are allowed outside the clipping area.
*
- * @param s the specified Shape object which will be intersected
- * with current clipping area.
+ * @param s
+ * the specified Shape object which will be intersected with
+ * current clipping area.
*/
public abstract void clip(Shape s);
/**
* Draws the outline of the specified Shape.
*
- * @param s the Shape which ouline is drawn.
+ * @param s
+ * the Shape which outline is drawn.
*/
public abstract void draw(Shape s);
/**
- * Draws the specified GlyphVector object's text at the point x, y.
+ * Draws the specified GlyphVector object's text at the point x, y.
*
- * @param g the GlyphVector object to be drawn.
- * @param x the X position where the GlyphVector's text should
- * be rendered.
- * @param y the Y position where the GlyphVector's text should
- * be rendered.
+ * @param g
+ * the GlyphVector object to be drawn.
+ * @param x
+ * the X position where the GlyphVector's text should be
+ * rendered.
+ * @param y
+ * the Y position where the GlyphVector's text should be
+ * rendered.
*/
public abstract void drawGlyphVector(GlyphVector g, float x, float y);
@@ -94,87 +102,107 @@ public abstract class Graphics2D extends Graphics {
* Draws the BufferedImage -- modified according to the operation
* BufferedImageOp -- at the point x, y.
*
- * @param img the BufferedImage to be rendered.
- * @param op the filter to be applied to the image before rendering.
- * @param x the X coordinate of the point where the image's upper left corner
- * will be placed.
- * @param y the Y coordinate of the point where the image's upper left corner
- * will be placed.
+ * @param img
+ * the BufferedImage to be rendered.
+ * @param op
+ * the filter to be applied to the image before rendering.
+ * @param x
+ * the X coordinate of the point where the image's upper left
+ * corner will be placed.
+ * @param y
+ * the Y coordinate of the point where the image's upper left
+ * corner will be placed.
*/
public abstract void drawImage(BufferedImage img, BufferedImageOp op, int x, int y);
/**
- * Draws BufferedImage transformed from image space into user space
+ * Draws BufferedImage transformed from image space into user space
* according to the AffineTransform xform and notifies the ImageObserver.
- *
- * @param img the BufferedImage to be rendered.
- * @param xform the affine transformation from the image to the user space.
- * @param obs the ImageObserver to be notified about the image conversion.
*
- * @return true, if the image is successfully loaded and rendered,
- * or it's null, otherwise false.
+ * @param img
+ * the BufferedImage to be rendered.
+ * @param xform
+ * the affine transformation from the image to the user space.
+ * @param obs
+ * the ImageObserver to be notified about the image conversion.
+ * @return true, if the image is successfully loaded and rendered, or it's
+ * null, otherwise false.
*/
public abstract boolean drawImage(Image img, AffineTransform xform, ImageObserver obs);
/**
- * Draws a RenderableImage which is transformed from image space into user
+ * Draws a RenderableImage which is transformed from image space into user
* according to the AffineTransform xform.
- *
- * @param img the RenderableImage to be rendered.
- * @param xform the affine transformation from image to user space.
+ *
+ * @param img
+ * the RenderableImage to be rendered.
+ * @param xform
+ * the affine transformation from image to user space.
*/
public abstract void drawRenderableImage(RenderableImage img, AffineTransform xform);
/**
- * Draws a RenderedImage which is transformed from image space into user
+ * Draws a RenderedImage which is transformed from image space into user
* according to the AffineTransform xform.
- *
- * @param img the RenderedImage to be rendered.
- * @param xform the affine transformation from image to user space.
+ *
+ * @param img
+ * the RenderedImage to be rendered.
+ * @param xform
+ * the affine transformation from image to user space.
*/
public abstract void drawRenderedImage(RenderedImage img, AffineTransform xform);
/**
- * Draws the string specified by the AttributedCharacterIterator.
- * The first character's position is specified by the X, Y parameters.
+ * Draws the string specified by the AttributedCharacterIterator. The first
+ * character's position is specified by the X, Y parameters.
*
- * @param iterator whose text is drawn.
- * @param x the X position where the first character is drawn.
- * @param y the Y position where the first character is drawn.
+ * @param iterator
+ * whose text is drawn.
+ * @param x
+ * the X position where the first character is drawn.
+ * @param y
+ * the Y position where the first character is drawn.
*/
public abstract void drawString(AttributedCharacterIterator iterator, float x, float y);
/**
- * Draws the string specified by the AttributedCharacterIterator.
- * The first character's position is specified by the X, Y parameters.
- *
- * @param iterator whose text is drawn.
- * @param x the X position where the first character is drawn.
- * @param y the Y position where the first character is drawn.
+ * Draws the string specified by the AttributedCharacterIterator. The first
+ * character's position is specified by the X, Y parameters.
*
+ * @param iterator
+ * whose text is drawn.
+ * @param x
+ * the X position where the first character is drawn.
+ * @param y
+ * the Y position where the first character is drawn.
* @see java.awt.Graphics#drawString(AttributedCharacterIterator, int, int)
*/
@Override
public abstract void drawString(AttributedCharacterIterator iterator, int x, int y);
/**
- * Draws the String whose the first character position is specified
- * by the parameters X, Y.
+ * Draws the String whose the first character position is specified by the
+ * parameters X, Y.
*
- * @param s the String to be drawn.
- * @param x the X position of the first character.
- * @param y the Y position of the first character.
+ * @param s
+ * the String to be drawn.
+ * @param x
+ * the X position of the first character.
+ * @param y
+ * the Y position of the first character.
*/
public abstract void drawString(String s, float x, float y);
/**
- * Draws the String whose the first character coordinates are specified
- * by the parameters X, Y.
- *
- * @param str the String to be drawn.
- * @param x the X coordinate of the first character.
- * @param y the Y coordinate of the first character.
+ * Draws the String whose the first character coordinates are specified by
+ * the parameters X, Y.
*
+ * @param str
+ * the String to be drawn.
+ * @param x
+ * the X coordinate of the first character.
+ * @param y
+ * the Y coordinate of the first character.
* @see java.awt.Graphics#drawString(String, int, int)
*/
@Override
@@ -183,7 +211,8 @@ public abstract class Graphics2D extends Graphics {
/**
* Fills the interior of the specified Shape.
*
- * @param s the Shape to be filled.
+ * @param s
+ * the Shape to be filled.
*/
public abstract void fill(Shape s);
@@ -204,7 +233,7 @@ public abstract class Graphics2D extends Graphics {
/**
* Gets the device configuration.
*
- * @return the device configuration
+ * @return the device configuration.
*/
public abstract GraphicsConfiguration getDeviceConfiguration();
@@ -223,17 +252,17 @@ public abstract class Graphics2D extends Graphics {
public abstract Paint getPaint();
/**
- * Gets the value of single preference for specified key.
- *
- * @param key the specified key of the rendering hint.
+ * Gets the value of single preference for specified key.
*
+ * @param key
+ * the specified key of the rendering hint.
* @return the value of rendering hint for specified key.
*/
public abstract Object getRenderingHint(RenderingHints.Key key);
/**
- * Gets the set of the rendering preferences as a collection of
- * key/value pairs.
+ * Gets the set of the rendering preferences as a collection of key/value
+ * pairs.
*
* @return the RenderingHints which contains the rendering preferences.
*/
@@ -254,172 +283,196 @@ public abstract class Graphics2D extends Graphics {
public abstract AffineTransform getTransform();
/**
- * Determines wether or not the specified Shape intersects the specified
- * Rectangle. If the onStroke parameter is true, this method
- * checks whether or not the specified Shape outline intersects the specified
- * Rectangle, otherwise this method checks whether or not the specified
- * Shape's interior intersects the specified Rectangle.
+ * Determines whether or not the specified Shape intersects the specified
+ * Rectangle. If the onStroke parameter is true, this method checks whether
+ * or not the specified Shape outline intersects the specified Rectangle,
+ * otherwise this method checks whether or not the specified Shape's
+ * interior intersects the specified Rectangle.
*
- * @param rect the specified Rectangle.
- * @param s the Shape to check for intersection.
- * @param onStroke the parameter determines whether or not this method checks
- * for intersection of the Shape outline or of the Shape interior with
- * the Rectangle.
- *
- * @return true, if there is a hit, otherwise false.
+ * @param rect
+ * the specified Rectangle.
+ * @param s
+ * the Shape to check for intersection.
+ * @param onStroke
+ * the parameter determines whether or not this method checks for
+ * intersection of the Shape outline or of the Shape interior
+ * with the Rectangle.
+ * @return true, if there is a hit, false otherwise.
*/
public abstract boolean hit(Rectangle rect, Shape s, boolean onStroke);
/**
* Performs a rotation transform relative to current Graphics2D Transform.
- * The coordinate system is rotated by the specified angle in radians relative to
- * current origin.
+ * The coordinate system is rotated by the specified angle in radians
+ * relative to current origin.
*
- * @param theta the angle of rotation in radians.
+ * @param theta
+ * the angle of rotation in radians.
*/
public abstract void rotate(double theta);
/**
- * Performs a translated rotation transform relative to current Graphics2D
- * Transform. The coordinate system is rotated by the specified angle in radians
- * relative to current origin and then moved to point (x, y).
- *
- * Is this right?
+ * Performs a translated rotation transform relative to current Graphics2D
+ * Transform. The coordinate system is rotated by the specified angle in
+ * radians relative to current origin and then moved to point (x, y). Is
+ * this right?
*
- * @param theta the angle of rotation in radians.
- * @param x the X coordinate.
- * @param y the Y coordinate.
+ * @param theta
+ * the angle of rotation in radians.
+ * @param x
+ * the X coordinate.
+ * @param y
+ * the Y coordinate.
*/
public abstract void rotate(double theta, double x, double y);
/**
- * Performs a linear scale transform relative to current Graphics2D Transform.
- * The coordinate system is rescaled vertically and horizontally
+ * Performs a linear scale transform relative to current Graphics2D
+ * Transform. The coordinate system is rescaled vertically and horizontally
* by the specified parameters.
*
- * @param sx the scaling factor by which the X coordinate is multiplied.
- * @param sy the scaling factor by which the Y coordinate is multiplied.
+ * @param sx
+ * the scaling factor by which the X coordinate is multiplied.
+ * @param sy
+ * the scaling factor by which the Y coordinate is multiplied.
*/
public abstract void scale(double sx, double sy);
/**
- * Sets a new background color for clearing rectangular areas.
- * The clearRect method uses the current background color.
+ * Sets a new background color for clearing rectangular areas. The clearRect
+ * method uses the current background color.
*
- * @param color the new background color.
+ * @param color
+ * the new background color.
*/
public abstract void setBackground(Color color);
/**
- * Sets the current composite for Graphics2D.
+ * Sets the current composite for Graphics2D.
*
- * @param comp the Composite object.
+ * @param comp
+ * the Composite object.
*/
public abstract void setComposite(Composite comp);
/**
* Sets the paint for Graphics2D.
*
- * @param paint the Paint object.
+ * @param paint
+ * the Paint object.
*/
public abstract void setPaint(Paint paint);
/**
* Sets a key-value pair in the current RenderingHints map.
*
- * @param key the key of the rendering hint to set.
- * @param value the value to set for the rendering hint.
+ * @param key
+ * the key of the rendering hint to set.
+ * @param value
+ * the value to set for the rendering hint.
*/
public abstract void setRenderingHint(RenderingHints.Key key, Object value);
/**
- * Replaces the current rendering hints with the specified rendering preferences.
+ * Replaces the current rendering hints with the specified rendering
+ * preferences.
*
- * @param hints the new Map of rendering hints.
+ * @param hints
+ * the new Map of rendering hints.
*/
public abstract void setRenderingHints(Map, ?> hints);
/**
* Sets the stroke for the Graphics2D.
*
- * @param s the Stroke object.
+ * @param s
+ * the Stroke object.
*/
public abstract void setStroke(Stroke s);
/**
- * Overwrite the current Transform of the Graphics2D. The specified Transform
- * should be received from the getTransform() method and should be used
- * only for restoring the original Graphics2D transform after calling
- * draw or fill methods.
+ * Overwrite the current Transform of the Graphics2D. The specified
+ * Transform should be received from the getTransform() method and should be
+ * used only for restoring the original Graphics2D transform after calling
+ * draw or fill methods.
*
- * @param Tx the specified Transform.
+ * @param Tx
+ * the specified Transform.
*/
public abstract void setTransform(AffineTransform Tx);
/**
- * Performs a shear transform relative to current Graphics2D Transform.
- * The coordinate system is shifted by the specified multipliers relative to
+ * Performs a shear transform relative to current Graphics2D Transform. The
+ * coordinate system is shifted by the specified multipliers relative to
* current position.
*
- * @param shx the multiplier by which the X coordinates shift position
- * along X axis as a function of Y coordinates.
- * @param shy the multiplier by which the Y coordinates shift position
- * along Y axis as a function of X coordinates.
+ * @param shx
+ * the multiplier by which the X coordinates shift position along
+ * X axis as a function of Y coordinates.
+ * @param shy
+ * the multiplier by which the Y coordinates shift position along
+ * Y axis as a function of X coordinates.
*/
public abstract void shear(double shx, double shy);
/**
- * Concatenates the AffineTransform object with current Transform
- * of this Graphics2D. The transforms are applied in reverse order
- * with the last specified transform applied first and the next
- * transformation applied to the result of previous transformation.
- * More precisely, if Cx is the current Graphics2D transform, the
- * transform method's result with Tx as the parameter
- * is the transformation Rx, where Rx(p) = Cx(Tx(p)), for p - a point
- * in current coordinate system. Rx becomes the current Transform
+ * Concatenates the AffineTransform object with current Transform of this
+ * Graphics2D. The transforms are applied in reverse order with the last
+ * specified transform applied first and the next transformation applied to
+ * the result of previous transformation. More precisely, if Cx is the
+ * current Graphics2D transform, the transform method's result with Tx as
+ * the parameter is the transformation Rx, where Rx(p) = Cx(Tx(p)), for p -
+ * a point in current coordinate system. Rx becomes the current Transform
* for this Graphics2D.
*
- * @param Tx the AffineTransform object to be concatenated with
- * current Transform.
+ * @param Tx
+ * the AffineTransform object to be concatenated with current
+ * Transform.
*/
public abstract void transform(AffineTransform Tx);
/**
* Performs a translate transform relative to current Graphics2D Transform.
- * The coordinate system is moved by the specified distance relative
- * to current position.
+ * The coordinate system is moved by the specified distance relative to
+ * current position.
*
- * @param tx the translation distance along the X axis.
- * @param ty the translation distance along the Y axis.
+ * @param tx
+ * the translation distance along the X axis.
+ * @param ty
+ * the translation distance along the Y axis.
*/
public abstract void translate(double tx, double ty);
/**
- * Moves the origin Graphics2D Transform to the point with x, y
- * coordinates in current coordinate system. The new origin of coordinate
- * system is moved to the (x, y) point accordingly. All rendering and
- * transform operations are performed relative to this new origin.
- *
- * @param x the X coordinate.
- * @param y the Y coordinate.
+ * Moves the origin Graphics2D Transform to the point with x, y coordinates
+ * in current coordinate system. The new origin of coordinate system is
+ * moved to the (x, y) point accordingly. All rendering and transform
+ * operations are performed relative to this new origin.
*
+ * @param x
+ * the X coordinate.
+ * @param y
+ * the Y coordinate.
* @see java.awt.Graphics#translate(int, int)
*/
@Override
public abstract void translate(int x, int y);
/**
- * Fills a 3D rectangle with the current color.
- * The rectangle is specified by its width, height, and top left corner
- * coordinates.
- *
- * @param x the X coordinate of the rectangle's top left corner.
- * @param y the Y coordinate of the rectangle's top left corner.
- * @param width the width of rectangle.
- * @param height the height of rectangle.
- * @param raised a boolean value that determines whether the rectangle
- * is drawn as raised or indented.
- *
+ * Fills a 3D rectangle with the current color. The rectangle is specified
+ * by its width, height, and top left corner coordinates.
+ *
+ * @param x
+ * the X coordinate of the rectangle's top left corner.
+ * @param y
+ * the Y coordinate of the rectangle's top left corner.
+ * @param width
+ * the width of rectangle.
+ * @param height
+ * the height of rectangle.
+ * @param raised
+ * a boolean value that determines whether the rectangle is drawn
+ * as raised or indented.
* @see java.awt.Graphics#fill3DRect(int, int, int, int, boolean)
*/
@Override
@@ -433,15 +486,19 @@ public abstract class Graphics2D extends Graphics {
}
/**
- * Draws the higlighted outline of a rectangle.
+ * Draws the highlighted outline of a rectangle.
*
- * @param x the X coordinate of the rectangle's top left corner.
- * @param y the Y coordinate of the rectangle's top left corner.
- * @param width the width of rectangle.
- * @param height the height of rectangle.
- * @param raised a boolean value that determines whether the rectangle
- * is drawn as raised or indented.
- *
+ * @param x
+ * the X coordinate of the rectangle's top left corner.
+ * @param y
+ * the Y coordinate of the rectangle's top left corner.
+ * @param width
+ * the width of rectangle.
+ * @param height
+ * the height of rectangle.
+ * @param raised
+ * a boolean value that determines whether the rectangle is drawn
+ * as raised or indented.
* @see java.awt.Graphics#draw3DRect(int, int, int, int, boolean)
*/
@Override
diff --git a/awt/java/awt/GraphicsConfiguration.java b/awt/java/awt/GraphicsConfiguration.java
index 8bec253b8c77bee621ba32c3934283313ea82438..d59e896abb715532c80b7ce9caddec2c467b8383 100644
--- a/awt/java/awt/GraphicsConfiguration.java
+++ b/awt/java/awt/GraphicsConfiguration.java
@@ -18,6 +18,7 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.geom.AffineTransform;
@@ -30,70 +31,76 @@ import org.apache.harmony.awt.internal.nls.Messages;
/**
* The GraphicsConfiguration class contains the characteristics of graphics
* devices such as a printer or monitor, and represents device's capabilities
- * and modes. Many GraphicsConfiguration objects can be associated with
- * single graphics device.
+ * and modes. Many GraphicsConfiguration objects can be associated with single
+ * graphics device.
+ *
+ * @since Android 1.0
*/
public abstract class GraphicsConfiguration {
-
- /**
- * Constructor could not be used directly and should be obtained in
- * extended classes.
- */
+ /**
+ * Constructor could not be used directly and should be obtained in extended
+ * classes.
+ */
protected GraphicsConfiguration() {
}
-
- /**
- * Creates BufferedImage image object with a data layout and color model
- * compatible with this GraphicsConfiguration with specified width
- * and height parameters.
- *
- * @param width the width of BufferedImage.
- * @param height the height of BufferedImage.
- *
- * @return the BufferedImage object with specified width and height
- * parameters.
- */
+ /**
+ * Creates BufferedImage image object with a data layout and color model
+ * compatible with this GraphicsConfiguration with specified width and
+ * height parameters.
+ *
+ * @param width
+ * the width of BufferedImage.
+ * @param height
+ * the height of BufferedImage.
+ * @return the BufferedImage object with specified width and height
+ * parameters.
+ */
public abstract BufferedImage createCompatibleImage(int width, int height);
/**
* Creates a BufferedImage that has the specified width, height,
- * transparency and has a data layout and color model compatible with this
- * GraphicsConfiguration.
- *
- * @param width the width of image.
- * @param height the height of image.
- * @param transparency the transparency mode.
+ * transparency and has a data layout and color model compatible with this
+ * GraphicsConfiguration.
*
+ * @param width
+ * the width of image.
+ * @param height
+ * the height of image.
+ * @param transparency
+ * the transparency mode.
* @return the BufferedImage object.
*/
public abstract BufferedImage createCompatibleImage(int width, int height, int transparency);
/**
- * Creates a VolatileImage that has the specified width and height
- * and has a data layout and color model compatible with this
- * GraphicsConfiguration.
- *
- * @param width the width of image.
- * @param height the height of image.
+ * Creates a VolatileImage that has the specified width and height and has a
+ * data layout and color model compatible with this GraphicsConfiguration.
*
+ * @param width
+ * the width of image.
+ * @param height
+ * the height of image.
* @return the VolatileImage object.
*/
public abstract VolatileImage createCompatibleVolatileImage(int width, int height);
/**
* Creates a VolatileImage that supports the specified width, height,
- * transparency and has a data layout and color model compatible with this
- * GraphicsConfiguration.
- *
- * @param width the width of image.
- * @param height the height of image.
- * @param transparency the transparency mode.
+ * transparency and has a data layout and color model compatible with this
+ * GraphicsConfiguration.
*
+ * @param width
+ * the width of image.
+ * @param height
+ * the height of image.
+ * @param transparency
+ * the transparency mode.
* @return the VolatileImage object.
*/
- public abstract VolatileImage createCompatibleVolatileImage(int width, int height, int transparency);
+ public abstract VolatileImage createCompatibleVolatileImage(int width, int height,
+ int transparency);
/**
* Gets the bounds of area covered by the GraphicsConfiguration in the
@@ -111,20 +118,19 @@ public abstract class GraphicsConfiguration {
public abstract ColorModel getColorModel();
/**
- * Gets the ColorModel of the GraphicsConfiguration which
- * supports specified Transparency.
+ * Gets the ColorModel of the GraphicsConfiguration which supports specified
+ * Transparency.
*
- * @param transparency the Transparency mode: OPAQUE, BITMASK, or
- * TRANSLUCENT.
- *
- * @return the ColorModel of the GraphicsConfiguration which
- * supports specified Transparency.
+ * @param transparency
+ * the Transparency mode: OPAQUE, BITMASK, or TRANSLUCENT.
+ * @return the ColorModel of the GraphicsConfiguration which supports
+ * specified Transparency.
*/
public abstract ColorModel getColorModel(int transparency);
/**
- * Gets the default AffineTransform of the GraphicsConfiguration.
- * This method translates user coordinates to device coordinates.
+ * Gets the default AffineTransform of the GraphicsConfiguration. This
+ * method translates user coordinates to device coordinates.
*
* @return the default AffineTransform of the GraphicsConfiguration.
*/
@@ -144,23 +150,24 @@ public abstract class GraphicsConfiguration {
*/
public abstract AffineTransform getNormalizingTransform();
-
/**
- * Creates VolatileImage with specified width, height, ImageCapabilities;
- * a data layout and color model compatible with this GraphicsConfiguration.
- *
- * @param width the width of image.
- * @param height the height of image.
- * @param caps the ImageCapabilities object.
- *
- * @return the VolatileImage which data layout and color model compatible
- * with this GraphicsConfiguration.
- *
- * @throws AWTException if ImageCapabilities is not supported by the
- * GraphicsConfiguration.
+ * Creates VolatileImage with specified width, height, ImageCapabilities; a
+ * data layout and color model compatible with this GraphicsConfiguration.
+ *
+ * @param width
+ * the width of image.
+ * @param height
+ * the height of image.
+ * @param caps
+ * the ImageCapabilities object.
+ * @return the VolatileImage which data layout and color model compatible
+ * with this GraphicsConfiguration.
+ * @throws AWTException
+ * if ImageCapabilities is not supported by the
+ * GraphicsConfiguration.
*/
- public VolatileImage createCompatibleVolatileImage(int width, int height,
- ImageCapabilities caps) throws AWTException {
+ public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps)
+ throws AWTException {
VolatileImage res = createCompatibleVolatileImage(width, height);
if (!res.getCapabilities().equals(caps)) {
// awt.14A=Can not create VolatileImage with specified capabilities
@@ -170,21 +177,23 @@ public abstract class GraphicsConfiguration {
}
/**
- * Creates a VolatileImage with specified width, height, transparency
- * and ImageCapabilities; a data layout and color model compatible with
- * this GraphicsConfiguration.
- *
- * @param width the width of image.
- * @param height the height of image.
- * @param caps the ImageCapabilities object.
- * @param transparency the Transparency mode: OPAQUE, BITMASK, or
- * TRANSLUCENT.
- *
- * @return the VolatileImage which data layout and color model compatible
- * with this GraphicsConfiguration.
- *
- * @throws AWTException if ImageCapabilities is not supported by the
+ * Creates a VolatileImage with specified width, height, transparency and
+ * ImageCapabilities; a data layout and color model compatible with this
* GraphicsConfiguration.
+ *
+ * @param width
+ * the width of image.
+ * @param height
+ * the height of image.
+ * @param caps
+ * the ImageCapabilities object.
+ * @param transparency
+ * the Transparency mode: OPAQUE, BITMASK, or TRANSLUCENT.
+ * @return the VolatileImage which data layout and color model compatible
+ * with this GraphicsConfiguration.
+ * @throws AWTException
+ * if ImageCapabilities is not supported by the
+ * GraphicsConfiguration.
*/
public VolatileImage createCompatibleVolatileImage(int width, int height,
ImageCapabilities caps, int transparency) throws AWTException {
@@ -199,7 +208,7 @@ public abstract class GraphicsConfiguration {
/**
* Gets the buffering capabilities of the GraphicsConfiguration.
*
- * @return the BufferCapabilities object.
+ * @return the BufferCapabilities object.
*/
public BufferCapabilities getBufferCapabilities() {
return new BufferCapabilities(new ImageCapabilities(false), new ImageCapabilities(false),
diff --git a/awt/java/awt/GraphicsDevice.java b/awt/java/awt/GraphicsDevice.java
index 8cf700a95b841ad49e5dfae7cdcd641a15098c3b..9eda4e0eda796feb4869b6ce1dc7a6e797768f2f 100644
--- a/awt/java/awt/GraphicsDevice.java
+++ b/awt/java/awt/GraphicsDevice.java
@@ -18,50 +18,61 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
import org.apache.harmony.awt.internal.nls.Messages;
/**
- * The GraphicsDevice class describes the graphics devices (such as screens
- * or printers) which are available in a particular graphics environment.
- * Many GraphicsDevice instances can be associated with a single
- * GraphicsEnvironment. Each GraphicsDevice has one or more GraphicsConfiguration
- * objects which specify the different configurations and modes of GraphicsDevice.
+ * The GraphicsDevice class describes the graphics devices (such as screens or
+ * printers) which are available in a particular graphics environment. Many
+ * GraphicsDevice instances can be associated with a single GraphicsEnvironment.
+ * Each GraphicsDevice has one or more GraphicsConfiguration objects which
+ * specify the different configurations and modes of GraphicsDevice.
+ *
+ * @since Android 1.0
*/
public abstract class GraphicsDevice {
-
- /** The display mode. */
+
+ /**
+ * The display mode.
+ */
private DisplayMode displayMode;
- //???AWT
-// private Window fullScreenWindow = null;
+ // ???AWT
+ // private Window fullScreenWindow = null;
- /** The Constant TYPE_IMAGE_BUFFER indicates a image buffer device. */
+ /**
+ * The Constant TYPE_IMAGE_BUFFER indicates a image buffer device.
+ */
public static final int TYPE_IMAGE_BUFFER = 2;
- /** The Constant TYPE_PRINTER indicates a printer device. */
+ /**
+ * The Constant TYPE_PRINTER indicates a printer device.
+ */
public static final int TYPE_PRINTER = 1;
- /** The Constant TYPE_RASTER_SCREEN indicates a raster screen device. */
+ /**
+ * The Constant TYPE_RASTER_SCREEN indicates a raster screen device.
+ */
public static final int TYPE_RASTER_SCREEN = 0;
- /**
- * Constructor is not to be used directly as this class is abstract.
- */
+ /**
+ * Constructor is not to be used directly as this class is abstract.
+ */
protected GraphicsDevice() {
- displayMode = new DisplayMode(0, 0, DisplayMode.BIT_DEPTH_MULTI, DisplayMode.REFRESH_RATE_UNKNOWN);
+ displayMode = new DisplayMode(0, 0, DisplayMode.BIT_DEPTH_MULTI,
+ DisplayMode.REFRESH_RATE_UNKNOWN);
}
-
- /**
- * Returns an array of GraphicsConfiguration objects associated
- * with the GraphicsDevice.
- *
- * @return an array of GraphicsConfiguration objects associated
- * with the GraphicsDevice.
- */
+ /**
+ * Returns an array of GraphicsConfiguration objects associated with the
+ * GraphicsDevice.
+ *
+ * @return an array of GraphicsConfiguration objects associated with the
+ * GraphicsDevice.
+ */
public abstract GraphicsConfiguration[] getConfigurations();
/**
@@ -72,41 +83,39 @@ public abstract class GraphicsDevice {
public abstract GraphicsConfiguration getDefaultConfiguration();
/**
- * Gets the String identifier which associated with the GraphicsDevice in
+ * Gets the String identifier which associated with the GraphicsDevice in
* the GraphicsEnvironment.
*
- * @return the String identifier of the GraphicsDevice in
- * the GraphicsEnvironment.
+ * @return the String identifier of the GraphicsDevice in the
+ * GraphicsEnvironment.
*/
public abstract String getIDstring();
/**
- * Gets the type of this GraphicsDevice:
- * TYPE_IMAGE_BUFFER, TYPE_PRINTER or TYPE_RASTER_SCREEN.
+ * Gets the type of this GraphicsDevice: TYPE_IMAGE_BUFFER, TYPE_PRINTER or
+ * TYPE_RASTER_SCREEN.
*
- * @return the type of this GraphicsDevice: TYPE_IMAGE_BUFFER,
- * TYPE_PRINTER or TYPE_RASTER_SCREEN.
+ * @return the type of this GraphicsDevice: TYPE_IMAGE_BUFFER, TYPE_PRINTER
+ * or TYPE_RASTER_SCREEN.
*/
public abstract int getType();
-
-
- /**
- * Returns the number of bytes available in accelerated
- * memory on this device.
- *
- * @return the number of bytes available accelerated memory.
- */
+ /**
+ * Returns the number of bytes available in accelerated memory on this
+ * device.
+ *
+ * @return the number of bytes available accelerated memory.
+ */
public int getAvailableAcceleratedMemory() {
return 0;
}
- /* ???AWT
- public GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate gct) {
- return gct.getBestConfiguration(getConfigurations());
- }
- */
-
+ /*
+ * ???AWT public GraphicsConfiguration
+ * getBestConfiguration(GraphicsConfigTemplate gct) { return
+ * gct.getBestConfiguration(getConfigurations()); }
+ */
+
/**
* Gets the current display mode of the GraphicsDevice.
*
@@ -122,43 +131,43 @@ public abstract class GraphicsDevice {
* @return an array of display modes available in this GraphicsDevice.
*/
public DisplayMode[] getDisplayModes() {
- DisplayMode []dms = {displayMode};
- return dms;
+ DisplayMode[] dms = {
+ displayMode
+ };
+ return dms;
}
- /* ???AWT
- public Window getFullScreenWindow() {
- return fullScreenWindow;
- }
- */
-
+ /*
+ * ???AWT public Window getFullScreenWindow() { return fullScreenWindow; }
+ */
+
/**
- * Returns true if this GraphicsDevice supports low-level
- * display changes.
+ * Returns true if this GraphicsDevice supports low-level display changes.
*
- * @return true, if this GraphicsDevice supports low-level
- * display changes; false otherwise.
+ * @return true, if this GraphicsDevice supports low-level display changes;
+ * false otherwise.
*/
public boolean isDisplayChangeSupported() {
return false;
}
/**
- * Returns true if this GraphicsDevice supports full screen
- * mode.
+ * Returns true if this GraphicsDevice supports full screen mode.
*
- * @return true, if this GraphicsDevice supports full screen
- * mode; otherwise false.
+ * @return true, if this GraphicsDevice supports full screen mode, false
+ * otherwise.
*/
public boolean isFullScreenSupported() {
return false;
}
- //an array of display modes available in this GraphicsDevice.
-
+
+ // an array of display modes available in this GraphicsDevice.
+
/**
* Sets the display mode of this GraphicsDevice.
*
- * @param dm the new display mode of this GraphicsDevice.
+ * @param dm
+ * the new display mode of this GraphicsDevice.
*/
public void setDisplayMode(DisplayMode dm) {
if (!isDisplayChangeSupported()) {
@@ -166,7 +175,7 @@ public abstract class GraphicsDevice {
throw new UnsupportedOperationException(Messages.getString("awt.122")); //$NON-NLS-1$
}
- DisplayMode []dms = getDisplayModes();
+ DisplayMode[] dms = getDisplayModes();
for (DisplayMode element : dms) {
if (element.equals(dm)) {
displayMode = dm;
@@ -177,23 +186,11 @@ public abstract class GraphicsDevice {
throw new IllegalArgumentException(Messages.getString("awt.123", dm)); //$NON-NLS-1$
}
- /* ???AWT
- public void setFullScreenWindow(Window w) {
- if (w == null) {
- fullScreenWindow = null;
- return;
- }
-
- fullScreenWindow = w;
-
- if (isFullScreenSupported()) {
- w.enableInputMethods(false);
- } else {
- w.setSize(displayMode.getWidth(), displayMode.getHeight());
- w.setLocation(0, 0);
- }
- w.setVisible(true);
- w.setAlwaysOnTop(true);
- }
- */
+ /*
+ * ???AWT public void setFullScreenWindow(Window w) { if (w == null) {
+ * fullScreenWindow = null; return; } fullScreenWindow = w; if
+ * (isFullScreenSupported()) { w.enableInputMethods(false); } else {
+ * w.setSize(displayMode.getWidth(), displayMode.getHeight());
+ * w.setLocation(0, 0); } w.setVisible(true); w.setAlwaysOnTop(true); }
+ */
}
diff --git a/awt/java/awt/GraphicsEnvironment.java b/awt/java/awt/GraphicsEnvironment.java
index 3b14f55b40b1650f9f236fe3fe7670db4e489d2f..d527417f732e9c2d205b578ef6067acd924fdd32 100644
--- a/awt/java/awt/GraphicsEnvironment.java
+++ b/awt/java/awt/GraphicsEnvironment.java
@@ -28,17 +28,20 @@ import org.apache.harmony.awt.ContextStorage;
import org.apache.harmony.awt.gl.CommonGraphics2DFactory;
/**
- * The GraphicsEnvironment class defines a collection of GraphicsDevice
- * objects and Font objects which are available for Java application on
- * current platform.
+ * The GraphicsEnvironment class defines a collection of GraphicsDevice objects
+ * and Font objects which are available for Java application on current
+ * platform.
+ *
+ * @since Android 1.0
*/
public abstract class GraphicsEnvironment {
-
+
/**
- * Constructor could not be used directly and should be obtained in
- * extended classes.
+ * Constructor could not be used directly and should be obtained in extended
+ * classes.
*/
- protected GraphicsEnvironment() {}
+ protected GraphicsEnvironment() {
+ }
/**
* Gets the local GraphicsEnvironment.
@@ -46,17 +49,16 @@ public abstract class GraphicsEnvironment {
* @return the local GraphicsEnvironment.
*/
public static GraphicsEnvironment getLocalGraphicsEnvironment() {
- synchronized(ContextStorage.getContextLock()) {
+ synchronized (ContextStorage.getContextLock()) {
if (ContextStorage.getGraphicsEnvironment() == null) {
- if (isHeadless()) {
- ContextStorage.setGraphicsEnvironment(new HeadlessGraphicsEnvironment());
+ if (isHeadless()) {
+ ContextStorage.setGraphicsEnvironment(new HeadlessGraphicsEnvironment());
} else {
- CommonGraphics2DFactory g2df =
- (CommonGraphics2DFactory) Toolkit.getDefaultToolkit().getGraphicsFactory();
-
- ContextStorage.setGraphicsEnvironment(
- g2df.createGraphicsEnvironment(ContextStorage.getWindowFactory())
- );
+ CommonGraphics2DFactory g2df = (CommonGraphics2DFactory)Toolkit
+ .getDefaultToolkit().getGraphicsFactory();
+
+ ContextStorage.setGraphicsEnvironment(g2df
+ .createGraphicsEnvironment(ContextStorage.getWindowFactory()));
}
}
@@ -65,24 +67,24 @@ public abstract class GraphicsEnvironment {
}
/**
- * Returns whether or not a display, keyboard, and mouse are supported
- * in this graphics environment.
+ * Returns whether or not a display, keyboard, and mouse are supported in
+ * this graphics environment.
*
- * @return true, if HeadlessException will be thrown from areas of
- * the graphics environment that are dependent on a display, keyboard,
- * or mouse; false otherwise.
+ * @return true, if HeadlessException will be thrown from areas of the
+ * graphics environment that are dependent on a display, keyboard,
+ * or mouse, false otherwise.
*/
public boolean isHeadlessInstance() {
return false;
}
/**
- * Checks whether or not a display, keyboard, and mouse are supported
- * in this environment.
+ * Checks whether or not a display, keyboard, and mouse are supported in
+ * this environment.
*
- * @return true, if a HeadlessException is thrown from areas of
- * the Toolkit and GraphicsEnvironment that are dependent on
- * a display, keyboard, or mouse; false otherwise.
+ * @return true, if a HeadlessException is thrown from areas of the Toolkit
+ * and GraphicsEnvironment that are dependent on a display,
+ * keyboard, or mouse, false otherwise.
*/
public static boolean isHeadless() {
return "true".equals(System.getProperty("java.awt.headless"));
@@ -92,8 +94,8 @@ public abstract class GraphicsEnvironment {
* Gets the maximum bounds of system centered windows.
*
* @return the maximum bounds of system centered windows.
- *
- * @throws HeadlessException if isHeadless() method returns true.
+ * @throws HeadlessException
+ * if isHeadless() method returns true.
*/
public Rectangle getMaximumWindowBounds() throws HeadlessException {
return getDefaultScreenDevice().getDefaultConfiguration().getBounds();
@@ -103,8 +105,8 @@ public abstract class GraphicsEnvironment {
* Gets the Point which should defines the center of system window.
*
* @return the Point where the system window should be centered.
- *
- * @throws HeadlessException if isHeadless() method returns true.
+ * @throws HeadlessException
+ * if isHeadless() method returns true.
*/
public Point getCenterPoint() throws HeadlessException {
Rectangle mwb = getMaximumWindowBounds();
@@ -112,9 +114,8 @@ public abstract class GraphicsEnvironment {
}
/**
- * Indicates that the primary font should be used.
- * Primary font is specified by initial system locale or default encoding).
- *
+ * Indicates that the primary font should be used. Primary font is specified
+ * by initial system locale or default encoding).
*/
public void preferLocaleFonts() {
// Note: API specification says following:
@@ -123,7 +124,8 @@ public abstract class GraphicsEnvironment {
// it may have no effect at all." So, doing nothing is an
// acceptable behavior for this method.
- // For now FontManager uses 1.4 font.properties scheme for font mapping, so
+ // For now FontManager uses 1.4 font.properties scheme for font mapping,
+ // so
// this method doesn't make any sense. The implementation of this method
// which will influence font mapping is postponed until
// 1.5 mapping scheme not implemented.
@@ -141,7 +143,8 @@ public abstract class GraphicsEnvironment {
// it may have no effect at all." So, doing nothing is an
// acceptable behavior for this method.
- // For now FontManager uses 1.4 font.properties scheme for font mapping, so
+ // For now FontManager uses 1.4 font.properties scheme for font mapping,
+ // so
// this method doesn't make any sense. The implementation of this method
// which will influence font mapping is postponed until
// 1.5 mapping scheme not implemented.
@@ -153,19 +156,19 @@ public abstract class GraphicsEnvironment {
* Creates the Graphics2D object for rendering to the specified
* BufferedImage.
*
- * @param bufferedImage the BufferedImage object.
- *
- * @return the Graphics2D object which allows to render to the specified
- * BufferedImage.
+ * @param bufferedImage
+ * the BufferedImage object.
+ * @return the Graphics2D object which allows to render to the specified
+ * BufferedImage.
*/
public abstract Graphics2D createGraphics(BufferedImage bufferedImage);
/**
- * Gets the array of all available fonts instances in this
+ * Gets the array of all available fonts instances in this
* GraphicsEnviroments.
*
- * @return the array of all available fonts instances in this
- * GraphicsEnviroments.
+ * @return the array of all available fonts instances in this
+ * GraphicsEnviroments.
*/
public abstract Font[] getAllFonts();
@@ -180,11 +183,11 @@ public abstract class GraphicsEnvironment {
* Gets the array of all available font family names for the specified
* locale.
*
- * @param locale the Locale object which represents geographical
- * region. The default locale is used if locale is null.
- *
- * @return the array of available font family names for the specified
- * locale.
+ * @param locale
+ * the Locale object which represents geographical region. The
+ * default locale is used if locale is null.
+ * @return the array of available font family names for the specified
+ * locale.
*/
public abstract String[] getAvailableFontFamilyNames(Locale locale);
@@ -192,18 +195,18 @@ public abstract class GraphicsEnvironment {
* Gets the default screen device as GraphicDevice object.
*
* @return the GraphicDevice object which represents default screen device.
- *
- * @throws HeadlessException if isHeadless() returns true.
+ * @throws HeadlessException
+ * if isHeadless() returns true.
*/
public abstract GraphicsDevice getDefaultScreenDevice() throws HeadlessException;
/**
* Gets an array of all available screen devices.
*
- * @return the array of GraphicsDevice obgects which represents
- * all available screen devices.
- *
- * @throws HeadlessException if isHeadless() returns true.
+ * @return the array of GraphicsDevice objects which represents all
+ * available screen devices.
+ * @throws HeadlessException
+ * if isHeadless() returns true.
*/
public abstract GraphicsDevice[] getScreenDevices() throws HeadlessException;
}
diff --git a/awt/java/awt/HeadlessException.java b/awt/java/awt/HeadlessException.java
index 28e463b3e01ec2b6f185a6118f2728ec52c9d23b..ec111f1e4ee8a3b9f236d955c6187a8711261926 100644
--- a/awt/java/awt/HeadlessException.java
+++ b/awt/java/awt/HeadlessException.java
@@ -18,16 +18,21 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
/**
- * The HeadlessException class provides notifications and error messages
- * when code that is dependent on a keyboard, display, or mouse is called
- * in an environment that does not support a keyboard, display, or mouse.
+ * The HeadlessException class provides notifications and error messages when
+ * code that is dependent on a keyboard, display, or mouse is called in an
+ * environment that does not support a keyboard, display, or mouse.
+ *
+ * @since Android 1.0
*/
public class HeadlessException extends UnsupportedOperationException {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = 167183644944358563L;
/**
@@ -40,7 +45,8 @@ public class HeadlessException extends UnsupportedOperationException {
/**
* Instantiates a new headless exception with the specified message.
*
- * @param msg the String which represents error message.
+ * @param msg
+ * the String which represents error message.
*/
public HeadlessException(String msg) {
super(msg);
diff --git a/awt/java/awt/HeadlessGraphicsEnvironment.java b/awt/java/awt/HeadlessGraphicsEnvironment.java
index 97f88d168de452951f967d660d2b8e38004b89b7..306393f33e9b92dab63fbd682ce429332b8618d6 100644
--- a/awt/java/awt/HeadlessGraphicsEnvironment.java
+++ b/awt/java/awt/HeadlessGraphicsEnvironment.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package java.awt;
import java.awt.GraphicsDevice;
@@ -23,30 +24,32 @@ import org.apache.harmony.awt.gl.CommonGraphicsEnvironment;
/**
* The HeadlessGraphicsEnvironment class is the CommonGraphicsEnvironment
- * implementation to use in the case where the environment lacks display,
+ * implementation to use in the case where the environment lacks display,
* keyboard, and mouse support.
+ *
+ * @since Android 1.0
*/
public class HeadlessGraphicsEnvironment extends CommonGraphicsEnvironment {
-
+
/**
- * Returns whether or not a display, keyboard, and mouse are supported
- * in this graphics environment.
+ * Returns whether or not a display, keyboard, and mouse are supported in
+ * this graphics environment.
*
- * @return true, if HeadlessException will be thrown from areas of
- * the graphics environment that are dependent on a display, keyboard,
- * or mouse; false otherwise.
+ * @return true, if HeadlessException will be thrown from areas of the
+ * graphics environment that are dependent on a display, keyboard,
+ * or mouse, false otherwise.
*/
@Override
public boolean isHeadlessInstance() {
return true;
}
-
+
/**
* Gets the default screen device as GraphicDevice object.
*
* @return the GraphicDevice object which represents default screen device.
- *
- * @throws HeadlessException if isHeadless() returns true.
+ * @throws HeadlessException
+ * if isHeadless() returns true.
*/
@Override
public GraphicsDevice getDefaultScreenDevice() throws HeadlessException {
@@ -56,10 +59,10 @@ public class HeadlessGraphicsEnvironment extends CommonGraphicsEnvironment {
/**
* Gets an array of all available screen devices.
*
- * @return the array of GraphicsDevice objects which represents
- * all available screen devices.
- *
- * @throws HeadlessException if isHeadless() returns true.
+ * @return the array of GraphicsDevice objects which represents all
+ * available screen devices.
+ * @throws HeadlessException
+ * if isHeadless() returns true.
*/
@Override
public GraphicsDevice[] getScreenDevices() throws HeadlessException {
diff --git a/awt/java/awt/HeadlessToolkit.java b/awt/java/awt/HeadlessToolkit.java
index a7dd557a4456568af3281903190f16b0aa854882..c64a85a617ecd7ee14a227103c10d49532d94036 100644
--- a/awt/java/awt/HeadlessToolkit.java
+++ b/awt/java/awt/HeadlessToolkit.java
@@ -26,136 +26,75 @@ package java.awt;
//import java.awt.dnd.InvalidDnDOperationException;
//import java.awt.dnd.peer.DragSourceContextPeer;
import java.awt.im.InputMethodHighlight;
-import java.awt.image.ColorModel;
-//import java.awt.peer.*;
+import java.awt.image.ColorModel; //import java.awt.peer.*;
//import java.beans.PropertyChangeSupport;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.apache.harmony.awt.ComponentInternals;
-//import org.apache.harmony.awt.datatransfer.DTK;
+import org.apache.harmony.awt.ComponentInternals; //import org.apache.harmony.awt.datatransfer.DTK;
import org.apache.harmony.awt.wtk.GraphicsFactory;
import org.apache.harmony.awt.wtk.NativeEventQueue;
import org.apache.harmony.awt.wtk.WindowFactory;
/**
- * The HeadlessToolkit class is a subclass of ToolkitImpl to
- * be used for graphical environments that lack keyboard and
- * mouse capabilities.
+ * The HeadlessToolkit class is a subclass of ToolkitImpl to be used for
+ * graphical environments that lack keyboard and mouse capabilities.
+ *
+ * @since Android 1.0
*/
public final class HeadlessToolkit extends ToolkitImpl {
-
- //???AWT
- /*
- @Override
- protected ButtonPeer createButton(Button a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected CheckboxPeer createCheckbox(Checkbox a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected ChoicePeer createChoice(Choice a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- public Cursor createCustomCursor(Image img, Point hotSpot, String name)
- throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected DialogPeer createDialog(Dialog a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- public T createDragGestureRecognizer(
- Class recognizerAbstractClass, DragSource ds, Component c, int srcActions,
- DragGestureListener dgl) {
- return null;
- }
-
- @Override
- public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge)
- throws InvalidDnDOperationException {
- throw new InvalidDnDOperationException();
- }
-
- @Override
- protected FileDialogPeer createFileDialog(FileDialog a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected FramePeer createFrame(Frame a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected LabelPeer createLabel(Label a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected ListPeer createList(List a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected MenuPeer createMenu(Menu a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected MenuBarPeer createMenuBar(MenuBar a0) throws HeadlessException {
- throw new HeadlessException();
- }
- @Override
- protected MenuItemPeer createMenuItem(MenuItem a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected PopupMenuPeer createPopupMenu(PopupMenu a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected ScrollbarPeer createScrollbar(Scrollbar a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected ScrollPanePeer createScrollPane(ScrollPane a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected TextAreaPeer createTextArea(TextArea a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected TextFieldPeer createTextField(TextField a0) throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- protected WindowPeer createWindow(Window a0) throws HeadlessException {
- throw new HeadlessException();
- }
- */
+ // ???AWT
+ /*
+ * @Override protected ButtonPeer createButton(Button a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected CheckboxPeer createCheckbox(Checkbox a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected CheckboxMenuItemPeer
+ * createCheckboxMenuItem(CheckboxMenuItem a0) throws HeadlessException {
+ * throw new HeadlessException(); }
+ * @Override protected ChoicePeer createChoice(Choice a0) throws
+ * HeadlessException { throw new HeadlessException(); } public Cursor
+ * createCustomCursor(Image img, Point hotSpot, String name) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected DialogPeer createDialog(Dialog a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override public T
+ * createDragGestureRecognizer( Class recognizerAbstractClass, DragSource
+ * ds, Component c, int srcActions, DragGestureListener dgl) { return null;
+ * }
+ * @Override public DragSourceContextPeer
+ * createDragSourceContextPeer(DragGestureEvent dge) throws
+ * InvalidDnDOperationException { throw new InvalidDnDOperationException();
+ * }
+ * @Override protected FileDialogPeer createFileDialog(FileDialog a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected FramePeer createFrame(Frame a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected LabelPeer createLabel(Label a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected ListPeer createList(List a0) throws HeadlessException
+ * { throw new HeadlessException(); }
+ * @Override protected MenuPeer createMenu(Menu a0) throws HeadlessException
+ * { throw new HeadlessException(); }
+ * @Override protected MenuBarPeer createMenuBar(MenuBar a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected MenuItemPeer createMenuItem(MenuItem a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected PopupMenuPeer createPopupMenu(PopupMenu a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected ScrollbarPeer createScrollbar(Scrollbar a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected ScrollPanePeer createScrollPane(ScrollPane a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected TextAreaPeer createTextArea(TextArea a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected TextFieldPeer createTextField(TextField a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ * @Override protected WindowPeer createWindow(Window a0) throws
+ * HeadlessException { throw new HeadlessException(); }
+ */
@Override
public Dimension getBestCursorSize(int prefWidth, int prefHeight) throws HeadlessException {
@@ -186,25 +125,18 @@ public final class HeadlessToolkit extends ToolkitImpl {
public int getMenuShortcutKeyMask() throws HeadlessException {
throw new HeadlessException();
}
-
- //???AWT
+
+ // ???AWT
/*
- @Override
- NativeEventQueue getNativeEventQueue() throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- public PrintJob getPrintJob(Frame frame, String jobtitle, JobAttributes jobAttributes,
- PageAttributes pageAttributes) throws IllegalArgumentException {
- throw new IllegalArgumentException();
- }
-
- @Override
- public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) throws NullPointerException {
- throw new NullPointerException();
- }
- */
+ * @Override NativeEventQueue getNativeEventQueue() throws HeadlessException
+ * { throw new HeadlessException(); }
+ * @Override public PrintJob getPrintJob(Frame frame, String jobtitle,
+ * JobAttributes jobAttributes, PageAttributes pageAttributes) throws
+ * IllegalArgumentException { throw new IllegalArgumentException(); }
+ * @Override public PrintJob getPrintJob(Frame frame, String jobtitle,
+ * Properties props) throws NullPointerException { throw new
+ * NullPointerException(); }
+ */
@Override
public Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException {
@@ -214,44 +146,37 @@ public final class HeadlessToolkit extends ToolkitImpl {
@Override
public int getScreenResolution() throws HeadlessException {
throw new HeadlessException();
- }
+ }
@Override
public Dimension getScreenSize() throws HeadlessException {
throw new HeadlessException();
}
-
- //???AWT
+
+ // ???AWT
/*
- @Override
- public Clipboard getSystemClipboard() throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- public Clipboard getSystemSelection() throws HeadlessException {
- throw new HeadlessException();
- }
-
- @Override
- WindowFactory getWindowFactory() throws HeadlessException {
- throw new HeadlessException();
- }
- */
+ * @Override public Clipboard getSystemClipboard() throws HeadlessException
+ * { throw new HeadlessException(); }
+ * @Override public Clipboard getSystemSelection() throws HeadlessException
+ * { throw new HeadlessException(); }
+ * @Override WindowFactory getWindowFactory() throws HeadlessException {
+ * throw new HeadlessException(); }
+ */
@Override
protected void init() {
lockAWT();
try {
ComponentInternals.setComponentInternals(new ComponentInternalsImpl());
- //???AWT: new EventQueue(this); // create the system EventQueue
- //???AWT: dispatcher = new Dispatcher(this);
+ // ???AWT: new EventQueue(this); // create the system EventQueue
+ // ???AWT: dispatcher = new Dispatcher(this);
desktopProperties = new HashMap();
- //???AWT: desktopPropsSupport = new PropertyChangeSupport(this);
-// ???AWT: awtEventsManager = new AWTEventsManager();
-// ???AWT: dispatchThread = new HeadlessEventDispatchThread(this, dispatcher);
-// ???AWT: dtk = DTK.getDTK();
- dispatchThread.start();
+ // ???AWT: desktopPropsSupport = new PropertyChangeSupport(this);
+ // ???AWT: awtEventsManager = new AWTEventsManager();
+ // ???AWT: dispatchThread = new HeadlessEventDispatchThread(this,
+ // dispatcher);
+ // ???AWT: dtk = DTK.getDTK();
+ dispatchThread.start();
} finally {
unlockAWT();
}
@@ -284,8 +209,8 @@ public final class HeadlessToolkit extends ToolkitImpl {
}
@Override
- Map mapInputMethodHighlightImpl(
- InputMethodHighlight highlight) throws HeadlessException {
+ Map mapInputMethodHighlightImpl(InputMethodHighlight highlight)
+ throws HeadlessException {
throw new HeadlessException();
}
diff --git a/awt/java/awt/IllegalComponentStateException.java b/awt/java/awt/IllegalComponentStateException.java
index 21dc35f220ed37ea555f242871b9cfdc438469f9..bed172998997fbd2b9813d863baf8b33a310345f 100644
--- a/awt/java/awt/IllegalComponentStateException.java
+++ b/awt/java/awt/IllegalComponentStateException.java
@@ -18,34 +18,38 @@
* @author Michael Danilov
* @version $Revision$
*/
+
package java.awt;
/**
- * The IllegalComponentStateException class is used to provide
- * notification that AWT component is not in an appropriate state
- * for the requested operation.
+ * The IllegalComponentStateException class is used to provide notification that
+ * AWT component is not in an appropriate state for the requested operation.
+ *
+ * @since Android 1.0
*/
public class IllegalComponentStateException extends IllegalStateException {
- /** The Constant serialVersionUID. */
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -1889339587208144238L;
/**
- * Instantiates a new IllegalComponentStateException with
- * the specified message.
+ * Instantiates a new IllegalComponentStateException with the specified
+ * message.
*
- * @param s the String message which describes the exception.
+ * @param s
+ * the String message which describes the exception.
*/
public IllegalComponentStateException(String s) {
super(s);
}
/**
- * Instantiates a new IllegalComponentStateException without
- * detailed message.
+ * Instantiates a new IllegalComponentStateException without detailed
+ * message.
*/
public IllegalComponentStateException() {
}
}
-
diff --git a/awt/java/awt/Image.java b/awt/java/awt/Image.java
index c217e380c74ade64750b1f7c2df35f121502b0de..7ae3ed8836e5e9189b20a5a9518012989125abd7 100644
--- a/awt/java/awt/Image.java
+++ b/awt/java/awt/Image.java
@@ -18,6 +18,7 @@
* @author Igor V. Stolyarov
* @version $Revision$
*/
+
package java.awt;
import java.awt.image.AreaAveragingScaleFilter;
@@ -30,64 +31,67 @@ import java.awt.image.ReplicateScaleFilter;
import org.apache.harmony.awt.internal.nls.Messages;
/**
- * The Image abstract class represents the graphic images.
+ * The Image abstract class represents the graphic images.
+ *
+ * @since Android 1.0
*/
public abstract class Image {
- /**
- * The UndefinedProperty object should be returned if
- * property is not defined for a particular image.
+ /**
+ * The UndefinedProperty object should be returned if property is not
+ * defined for a particular image.
*/
- public static final Object UndefinedProperty = new Object(); //$NON-LOCK-1$
+ public static final Object UndefinedProperty = new Object(); // $NON-LOCK-1$
- /**
- * The Constant SCALE_DEFAULT indicates the default image
- * scaling algorithm.
+ /**
+ * The Constant SCALE_DEFAULT indicates the default image scaling algorithm.
*/
public static final int SCALE_DEFAULT = 1;
- /**
- * The Constant SCALE_FAST indicates an image scaling algorithm which
- * places a higher priority on scaling speed than on the image's smoothness.
+ /**
+ * The Constant SCALE_FAST indicates an image scaling algorithm which places
+ * a higher priority on scaling speed than on the image's smoothness.
*/
public static final int SCALE_FAST = 2;
- /**
- * The Constant SCALE_SMOOTH indicates an image scaling algorithm which
- * places a higher priority on image smoothness than on scaling speed.
+ /**
+ * The Constant SCALE_SMOOTH indicates an image scaling algorithm which
+ * places a higher priority on image smoothness than on scaling speed.
*/
public static final int SCALE_SMOOTH = 4;
- /**
- * The Constant SCALE_REPLICATE indicates the image scaling
- * algorithm in the ReplicateScaleFilter class.
+ /**
+ * The Constant SCALE_REPLICATE indicates the image scaling algorithm in the
+ * ReplicateScaleFilter class.
*/
public static final int SCALE_REPLICATE = 8;
- /**
- * The Constant SCALE_AREA_AVERAGING indicates
- * the area averaging image scaling algorithm.
+ /**
+ * The Constant SCALE_AREA_AVERAGING indicates the area averaging image
+ * scaling algorithm.
*/
public static final int SCALE_AREA_AVERAGING = 16;
- /**
- * The acceleration priority indicates image acceleration.
+ /**
+ * The acceleration priority indicates image acceleration.
*/
protected float accelerationPriority = 0.5f;
- /** The Constant capabilities. */
+ /**
+ * The Constant capabilities.
+ */
private static final ImageCapabilities capabilities = new ImageCapabilities(false);
/**
- * Gets the image property with the specified name.
- * The UndefinedProperty object should be return if the property is
- * not specified for this image. The return value should be null if the
- * property is currently unknown yet and the specified ImageObserver is
- * to be notified later.
- *
- * @param name the name of image's property.
- * @param observer the ImageObserver.
+ * Gets the image property with the specified name. The UndefinedProperty
+ * object should be return if the property is not specified for this image.
+ * The return value should be null if the property is currently unknown yet
+ * and the specified ImageObserver is to be notified later.
*
+ * @param name
+ * the name of image's property.
+ * @param observer
+ * the ImageObserver.
* @return the Object which represents value of the specified property.
*/
public abstract Object getProperty(String name, ImageObserver observer);
@@ -100,39 +104,40 @@ public abstract class Image {
public abstract ImageProducer getSource();
/**
- * Gets the width of this image. The specified ImageObserver object
- * is notified when the width of this image is available.
- *
- * @param observer the ImageObserver object which is
- * is notified when the width of this image is available.
+ * Gets the width of this image. The specified ImageObserver object is
+ * notified when the width of this image is available.
*
- * @return the width of image, or -1 if the width of this image
- * is not available.
+ * @param observer
+ * the ImageObserver object which is is notified when the width
+ * of this image is available.
+ * @return the width of image, or -1 if the width of this image is not
+ * available.
*/
public abstract int getWidth(ImageObserver observer);
/**
- * Gets the height of this image. The specified ImageObserver object
- * is notified when the height of this image is available.
+ * Gets the height of this image. The specified ImageObserver object is
+ * notified when the height of this image is available.
*
- * @param observer the ImageObserver object which is
- * is notified when the height of this image is available.
- *
- * @return the height of image, or -1 if the height of this image
- * is not available.
+ * @param observer
+ * the ImageObserver object which is is notified when the height
+ * of this image is available.
+ * @return the height of image, or -1 if the height of this image is not
+ * available.
*/
public abstract int getHeight(ImageObserver observer);
/**
- * Gets the scaled instance of this Image. This method returns
- * an Image object constructed from the source of this image
- * with the specified width, height, and applied scaling
- * alghorithm.
- *
- * @param width the width of scaled Image.
- * @param height the height of scaled Image.
- * @param hints the constant which indicates scaling algorithm.
+ * Gets the scaled instance of this Image. This method returns an Image
+ * object constructed from the source of this image with the specified
+ * width, height, and applied scaling algorithm.
*
+ * @param width
+ * the width of scaled Image.
+ * @param height
+ * the height of scaled Image.
+ * @param hints
+ * the constant which indicates scaling algorithm.
* @return the scaled Image.
*/
public Image getScaledInstance(int width, int height, int hints) {
@@ -147,17 +152,16 @@ public abstract class Image {
}
/**
- * Gets a Graphics object for rendering this image.
- * This method can be used for off-screen images.
+ * Gets a Graphics object for rendering this image. This method can be used
+ * for off-screen images.
*
* @return a Graphics object for rendering to this image.
*/
public abstract Graphics getGraphics();
/**
- * Flushes resources which are used by this Image object.
- * This method resets the image to the reconstructered state
- * from the image's source.
+ * Flushes resources which are used by this Image object. This method resets
+ * the image to the reconstructed state from the image's source.
*/
public abstract void flush();
@@ -171,10 +175,10 @@ public abstract class Image {
}
/**
- * Sets the acceleration priority for this image.
- *
- * @param priority the new acceleration priority (value in the
- * range 0-1).
+ * Sets the acceleration priority for this image.
+ *
+ * @param priority
+ * the new acceleration priority (value in the range 0-1).
*/
public void setAccelerationPriority(float priority) {
if (priority < 0 || priority > 1) {
@@ -185,19 +189,17 @@ public abstract class Image {
}
/**
- * Gets an ImageCapabilities object of this Image object
- * for the specified GraphicsConfiguration.
- *
- * @param gc the specified GraphicsConfiguration object
- * (null value means default GraphicsConfiguration).
+ * Gets an ImageCapabilities object of this Image object for the specified
+ * GraphicsConfiguration.
*
- * @return an ImageCapabilities object of this Image object
- * for the specified GraphicsConfiguration.
+ * @param gc
+ * the specified GraphicsConfiguration object (null value means
+ * default GraphicsConfiguration).
+ * @return an ImageCapabilities object of this Image object for the
+ * specified GraphicsConfiguration.
*/
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
// Note: common image is not accelerated.
return capabilities;
}
}
-
-
diff --git a/awt/java/awt/ImageCapabilities.java b/awt/java/awt/ImageCapabilities.java
index 6e9ecfc3799b4cecdc3729da85d49013c0262622..c6d59462aea3a0e84ee1ea591fa4f4418b4ebb33 100644
--- a/awt/java/awt/ImageCapabilities.java
+++ b/awt/java/awt/ImageCapabilities.java
@@ -18,22 +18,27 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
/**
* The ImageCapabilities class gives information about an image's capabilities.
+ *
+ * @since Android 1.0
*/
public class ImageCapabilities implements Cloneable {
-
- /** The accelerated. */
+
+ /**
+ * The accelerated.
+ */
private final boolean accelerated;
/**
- * Instantiates a new ImageCapabilities with the specified
- * acceleration flag which indicates whether acceleration
- * is desired or not.
+ * Instantiates a new ImageCapabilities with the specified acceleration flag
+ * which indicates whether acceleration is desired or not.
*
- * @param accelerated the accelerated flag.
+ * @param accelerated
+ * the accelerated flag.
*/
public ImageCapabilities(boolean accelerated) {
this.accelerated = accelerated;
@@ -50,23 +55,22 @@ public class ImageCapabilities implements Cloneable {
}
/**
- * Returne true if the Image of this ImageCapabilities is or can be
+ * Returns true if the Image of this ImageCapabilities is or can be
* accelerated.
- *
+ *
* @return true, if the Image of this ImageCapabilities is or can be
- * accelerated, false otherwise.
+ * accelerated, false otherwise.
*/
public boolean isAccelerated() {
return accelerated;
}
/**
- * Returns true if this ImageCapabilities applies to
- * the VolatileImage which can lose its surfaces.
+ * Returns true if this ImageCapabilities applies to the VolatileImage which
+ * can lose its surfaces.
*
- * @return true if this ImageCapabilities applies to
- * the VolatileImage which can lose its surfaces,
- * false otherwise.
+ * @return true if this ImageCapabilities applies to the VolatileImage which
+ * can lose its surfaces, false otherwise.
*/
public boolean isTrueVolatile() {
return true;
diff --git a/awt/java/awt/Insets.java b/awt/java/awt/Insets.java
index 61f3fd8bf28f18082258d83fe8c7cbd152f0b976..04f198c619647ce693c4f5071eea96fc6972ad05 100644
--- a/awt/java/awt/Insets.java
+++ b/awt/java/awt/Insets.java
@@ -18,44 +18,49 @@
* @author Dmitry A. Durnev
* @version $Revision$
*/
+
package java.awt;
import java.io.Serializable;
import org.apache.harmony.misc.HashCode;
-
/**
- * The Insets class represents the borders of a container.
- * This class describes the space that a container should leave at each edge:
- * the top, the bottom, the right side, and the left side.
- * The space can be filled with a border, a blank space, or a title.
+ * The Insets class represents the borders of a container. This class describes
+ * the space that a container should leave at each edge: the top, the bottom,
+ * the right side, and the left side. The space can be filled with a border, a
+ * blank space, or a title.
+ *
+ * @since Android 1.0
*/
public class Insets implements Cloneable, Serializable {
- /** The Constant serialVersionUID. */
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -2272572637695466749L;
/**
- * The top inset indicates the size of the space added to the
- * top of the rectangle.
+ * The top inset indicates the size of the space added to the top of the
+ * rectangle.
*/
public int top;
- /**
- * The left inset indicates the size of the space added to the
- * left side of the rectangle.
+ /**
+ * The left inset indicates the size of the space added to the left side of
+ * the rectangle.
*/
public int left;
- /**
- * The bottom inset indicates the size of the space subtracted from
- * the bottom of the rectangle.
+ /**
+ * The bottom inset indicates the size of the space subtracted from the
+ * bottom of the rectangle.
*/
public int bottom;
- /** The right inset indicates the size of the space subtracted from
- * the right side of the rectangle.
+ /**
+ * The right inset indicates the size of the space subtracted from the right
+ * side of the rectangle.
*/
public int right;
@@ -63,10 +68,14 @@ public class Insets implements Cloneable, Serializable {
* Instantiates a new Inset object with the specified top, left, bottom,
* right parameters.
*
- * @param top the top inset.
- * @param left the left inset.
- * @param bottom the bottom inset.
- * @param right the right inset.
+ * @param top
+ * the top inset.
+ * @param left
+ * the left inset.
+ * @param bottom
+ * the bottom inset.
+ * @param right
+ * the right inset.
*/
public Insets(int top, int left, int bottom, int right) {
setValues(top, left, bottom, right);
@@ -100,10 +109,10 @@ public class Insets implements Cloneable, Serializable {
/**
* Checks if this Insets object is equal to the specified object.
*
- * @param o the Object to be compared.
- *
- * @return true, if the object is an Insets object whose data values
- * are equal to those of this object, false otherwise.
+ * @param o
+ * the Object to be compared.
+ * @return true, if the object is an Insets object whose data values are
+ * equal to those of this object, false otherwise.
*/
@Override
public boolean equals(Object o) {
@@ -111,9 +120,8 @@ public class Insets implements Cloneable, Serializable {
return true;
}
if (o instanceof Insets) {
- Insets i = (Insets) o;
- return ((i.left == left) && (i.bottom == bottom) &&
- (i.right == right) && (i.top == top));
+ Insets i = (Insets)o;
+ return ((i.left == left) && (i.bottom == bottom) && (i.right == right) && (i.top == top));
}
return false;
}
@@ -125,23 +133,26 @@ public class Insets implements Cloneable, Serializable {
*/
@Override
public String toString() {
- /* The format is based on 1.5 release behavior
- * which can be revealed by the following code:
- * System.out.println(new Insets(1, 2, 3, 4));
+ /*
+ * The format is based on 1.5 release behavior which can be revealed by
+ * the following code: System.out.println(new Insets(1, 2, 3, 4));
*/
- return (getClass().getName() +
- "[left=" + left + ",top=" + top + //$NON-NLS-1$ //$NON-NLS-2$
- ",right=" + right + ",bottom=" + bottom + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return (getClass().getName() + "[left=" + left + ",top=" + top + //$NON-NLS-1$ //$NON-NLS-2$
+ ",right=" + right + ",bottom=" + bottom + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/**
* Sets top, left, bottom, and right insets to the specified values.
*
- * @param top the top inset.
- * @param left the left inset.
- * @param bottom the bottom inset.
- * @param right the right inset.
+ * @param top
+ * the top inset.
+ * @param left
+ * the left inset.
+ * @param bottom
+ * the bottom inset.
+ * @param right
+ * the right inset.
*/
public void set(int top, int left, int bottom, int right) {
setValues(top, left, bottom, right);
@@ -150,10 +161,14 @@ public class Insets implements Cloneable, Serializable {
/**
* Sets the values.
*
- * @param top the top
- * @param left the left
- * @param bottom the bottom
- * @param right the right
+ * @param top
+ * the top.
+ * @param left
+ * the left.
+ * @param bottom
+ * the bottom.
+ * @param right
+ * the right.
*/
private void setValues(int top, int left, int bottom, int right) {
this.top = top;
@@ -162,4 +177,3 @@ public class Insets implements Cloneable, Serializable {
this.right = right;
}
}
-
diff --git a/awt/java/awt/ItemSelectable.java b/awt/java/awt/ItemSelectable.java
index a46364b031c0720e44f5932cc302027d5bbb884a..212cf709e5232c28487f8f45b99682a4acad559b 100644
--- a/awt/java/awt/ItemSelectable.java
+++ b/awt/java/awt/ItemSelectable.java
@@ -18,35 +18,41 @@
* @author Michael Danilov
* @version $Revision$
*/
+
package java.awt;
import java.awt.event.ItemListener;
/**
* The ItemSelectable interface represents a set of items which can be selected.
+ *
+ * @since Android 1.0
*/
public interface ItemSelectable {
/**
- * Adds an ItemListener for receiving item events when the state of an item
- * is changed by the user.
+ * Adds an ItemListener for receiving item events when the state of an item
+ * is changed by the user.
*
- * @param l the ItemListener.
+ * @param l
+ * the ItemListener.
*/
public void addItemListener(ItemListener l);
/**
- * Gets an array of the selected objects or null if there is no selected object.
- *
- * @return an array of the selected objects or null if there is no selected
+ * Gets an array of the selected objects or null if there is no selected
* object.
+ *
+ * @return an array of the selected objects or null if there is no selected
+ * object.
*/
public Object[] getSelectedObjects();
/**
* Removes the specified ItemListener.
*
- * @param l the ItemListener which will be removed.
+ * @param l
+ * the ItemListener which will be removed.
*/
public void removeItemListener(ItemListener l);
diff --git a/awt/java/awt/MenuComponent.java b/awt/java/awt/MenuComponent.java
index 9eb4f3d8d21e1fe4275c33344f3124b818e8c4b6..9c1b120e66779e77793ca936ff05e1615e9c6e18 100644
--- a/awt/java/awt/MenuComponent.java
+++ b/awt/java/awt/MenuComponent.java
@@ -21,8 +21,7 @@ import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.peer.MenuComponentPeer;
import java.io.Serializable;
-import java.util.Locale;
-//import javax.accessibility.Accessible;
+import java.util.Locale; //import javax.accessibility.Accessible;
//import javax.accessibility.AccessibleComponent;
//import javax.accessibility.AccessibleContext;
//import javax.accessibility.AccessibleRole;
@@ -31,371 +30,172 @@ import java.util.Locale;
import org.apache.harmony.awt.gl.MultiRectArea;
import org.apache.harmony.awt.state.MenuItemState;
import org.apache.harmony.awt.state.MenuState;
+import org.apache.harmony.luni.util.NotImplementedException;
/**
- * The MenuComponent abstract class is the superclass for menu
- * components. Menu components receive and process AWT events.
+ * The MenuComponent abstract class is the superclass for menu components. Menu
+ * components receive and process AWT events.
+ *
+ * @since Android 1.0
*/
public abstract class MenuComponent implements Serializable {
-
- /** The Constant serialVersionUID. */
+
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -4536902356223894379L;
- /** The name. */
+ /**
+ * The name.
+ */
private String name;
- /** The font. */
+ /**
+ * The font.
+ */
private Font font;
- /** The parent. */
+ /**
+ * The parent.
+ */
MenuContainer parent;
- /** The deprecated event handler. */
+ /**
+ * The deprecated event handler.
+ */
boolean deprecatedEventHandler = true;
- /** The selected item index. */
+ /**
+ * The selected item index.
+ */
private int selectedItemIndex;
- //???AWT: private AccessibleContext accessibleContext;
+ // ???AWT: private AccessibleContext accessibleContext;
- /** The toolkit. */
+ /**
+ * The toolkit.
+ */
final Toolkit toolkit = Toolkit.getDefaultToolkit();
- //???AWT
+ // ???AWT
/*
- protected abstract class AccessibleAWTMenuComponent extends AccessibleContext implements
- Serializable, AccessibleComponent, AccessibleSelection {
- private static final long serialVersionUID = -4269533416223798698L;
-
- public void addFocusListener(FocusListener listener) {
- }
-
- public boolean contains(Point pt) {
- return false;
- }
-
- public Accessible getAccessibleAt(Point pt) {
- return null;
- }
-
- public Color getBackground() {
- return null;
- }
-
- public Rectangle getBounds() {
- return null;
- }
-
- public Cursor getCursor() {
- return null;
- }
-
- public Font getFont() {
- return MenuComponent.this.getFont();
- }
-
- public FontMetrics getFontMetrics(Font font) {
- return null;
- }
-
- public Color getForeground() {
- return null;
- }
-
- public Point getLocation() {
- return null;
- }
-
- public Point getLocationOnScreen() {
- return null;
- }
-
- public Dimension getSize() {
- return null;
- }
-
- public boolean isEnabled() {
- return true; // always enabled
- }
-
- public boolean isFocusTraversable() {
- return true; // always focus traversable
- }
-
- public boolean isShowing() {
- return true;// always showing
- }
-
- public boolean isVisible() {
- return true; // always visible
- }
-
- public void removeFocusListener(FocusListener listener) {
- }
-
- public void requestFocus() {
- }
-
- public void setBackground(Color color) {
- }
-
- public void setBounds(Rectangle rect) {
- }
-
- public void setCursor(Cursor cursor) {
- }
-
- public void setEnabled(boolean enabled) {
- }
-
- public void setFont(Font font) {
- MenuComponent.this.setFont(font);
- }
-
- public void setForeground(Color color) {
- }
-
- public void setLocation(Point pt) {
- }
-
- public void setSize(Dimension pt) {
- }
-
- public void setVisible(boolean visible) {
- }
-
- public void addAccessibleSelection(int index) {
- }
-
- public void clearAccessibleSelection() {
- }
-
- public Accessible getAccessibleSelection(int index) {
- return null;
- }
-
- public int getAccessibleSelectionCount() {
- return 0;
- }
-
- public boolean isAccessibleChildSelected(int index) {
- return false;
- }
-
- public void removeAccessibleSelection(int index) {
- }
-
- public void selectAllAccessibleSelection() {
- }
-
- @Override
- public Accessible getAccessibleChild(int index) {
- return null;
- }
-
- @Override
- public int getAccessibleChildrenCount() {
- return 0;
- }
-
- @Override
- public AccessibleComponent getAccessibleComponent() {
- return this;
- }
-
- @Override
- public String getAccessibleDescription() {
- return super.getAccessibleDescription();
- }
-
- @Override
- public int getAccessibleIndexInParent() {
- toolkit.lockAWT();
- try {
- Accessible aParent = getAccessibleParent();
- int aIndex = -1;
- if (aParent instanceof MenuComponent) {
- MenuComponent parent = (MenuComponent) aParent;
- int count = parent.getItemCount();
- for (int i = 0; i < count; i++) {
- MenuComponent comp = parent.getItem(i);
- if (comp instanceof Accessible) {
- aIndex++;
- if (comp == MenuComponent.this) {
- return aIndex;
- }
- }
- }
- }
- return -1;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public String getAccessibleName() {
- return super.getAccessibleName();
- }
-
- @Override
- public Accessible getAccessibleParent() {
- toolkit.lockAWT();
- try {
- Accessible aParent = super.getAccessibleParent();
- if (aParent != null) {
- return aParent;
- }
- MenuContainer parent = getParent();
- if (parent instanceof Accessible) {
- aParent = (Accessible) parent;
- }
- return aParent;
- } finally {
- toolkit.unlockAWT();
- }
- }
-
- @Override
- public AccessibleRole getAccessibleRole() {
- return AccessibleRole.AWT_COMPONENT;
- }
-
- @Override
- public AccessibleSelection getAccessibleSelection() {
- return this;
- }
-
- @Override
- public AccessibleStateSet getAccessibleStateSet() {
- return new AccessibleStateSet();
- }
-
- @Override
- public Locale getLocale() {
- return Locale.getDefault();
- }
- }
- */
-
- /**
- * The accessor to MenuComponent internal state,
- * utilized by the visual theme.
- *
- * @throws HeadlessException the headless exception
- */
- //???AWT
+ * protected abstract class AccessibleAWTMenuComponent extends
+ * AccessibleContext implements Serializable, AccessibleComponent,
+ * AccessibleSelection { private static final long serialVersionUID =
+ * -4269533416223798698L; public void addFocusListener(FocusListener
+ * listener) { } public boolean contains(Point pt) { return false; } public
+ * Accessible getAccessibleAt(Point pt) { return null; } public Color
+ * getBackground() { return null; } public Rectangle getBounds() { return
+ * null; } public Cursor getCursor() { return null; } public Font getFont()
+ * { return MenuComponent.this.getFont(); } public FontMetrics
+ * getFontMetrics(Font font) { return null; } public Color getForeground() {
+ * return null; } public Point getLocation() { return null; } public Point
+ * getLocationOnScreen() { return null; } public Dimension getSize() {
+ * return null; } public boolean isEnabled() { return true; // always
+ * enabled } public boolean isFocusTraversable() { return true; // always
+ * focus traversable } public boolean isShowing() { return true;// always
+ * showing } public boolean isVisible() { return true; // always visible }
+ * public void removeFocusListener(FocusListener listener) { } public void
+ * requestFocus() { } public void setBackground(Color color) { } public void
+ * setBounds(Rectangle rect) { } public void setCursor(Cursor cursor) { }
+ * public void setEnabled(boolean enabled) { } public void setFont(Font
+ * font) { MenuComponent.this.setFont(font); } public void
+ * setForeground(Color color) { } public void setLocation(Point pt) { }
+ * public void setSize(Dimension pt) { } public void setVisible(boolean
+ * visible) { } public void addAccessibleSelection(int index) { } public
+ * void clearAccessibleSelection() { } public Accessible
+ * getAccessibleSelection(int index) { return null; } public int
+ * getAccessibleSelectionCount() { return 0; } public boolean
+ * isAccessibleChildSelected(int index) { return false; } public void
+ * removeAccessibleSelection(int index) { } public void
+ * selectAllAccessibleSelection() { }
+ * @Override public Accessible getAccessibleChild(int index) { return null;
+ * }
+ * @Override public int getAccessibleChildrenCount() { return 0; }
+ * @Override public AccessibleComponent getAccessibleComponent() { return
+ * this; }
+ * @Override public String getAccessibleDescription() { return
+ * super.getAccessibleDescription(); }
+ * @Override public int getAccessibleIndexInParent() { toolkit.lockAWT();
+ * try { Accessible aParent = getAccessibleParent(); int aIndex = -1; if
+ * (aParent instanceof MenuComponent) { MenuComponent parent =
+ * (MenuComponent) aParent; int count = parent.getItemCount(); for (int i =
+ * 0; i < count; i++) { MenuComponent comp = parent.getItem(i); if (comp
+ * instanceof Accessible) { aIndex++; if (comp == MenuComponent.this) {
+ * return aIndex; } } } } return -1; } finally { toolkit.unlockAWT(); } }
+ * @Override public String getAccessibleName() { return
+ * super.getAccessibleName(); }
+ * @Override public Accessible getAccessibleParent() { toolkit.lockAWT();
+ * try { Accessible aParent = super.getAccessibleParent(); if (aParent !=
+ * null) { return aParent; } MenuContainer parent = getParent(); if (parent
+ * instanceof Accessible) { aParent = (Accessible) parent; } return aParent;
+ * } finally { toolkit.unlockAWT(); } }
+ * @Override public AccessibleRole getAccessibleRole() { return
+ * AccessibleRole.AWT_COMPONENT; }
+ * @Override public AccessibleSelection getAccessibleSelection() { return
+ * this; }
+ * @Override public AccessibleStateSet getAccessibleStateSet() { return new
+ * AccessibleStateSet(); }
+ * @Override public Locale getLocale() { return Locale.getDefault(); } }
+ */
+
+ /**
+ * The accessor to MenuComponent internal state, utilized by the visual
+ * theme.
+ *
+ * @throws HeadlessException
+ * the headless exception.
+ */
+ // ???AWT
/*
- class State implements MenuState {
- Dimension size;
-
- Dimension getSize() {
- if (size == null) {
- calculate();
- }
- return size;
- }
-
- public int getWidth() {
- return getSize().width;
- }
-
- public int getHeight() {
- return getSize().height;
- }
-
- public Font getFont() {
- return MenuComponent.this.getFont();
- }
-
- public int getItemCount() {
- return MenuComponent.this.getItemCount();
- }
-
- public int getSelectedItemIndex() {
- return MenuComponent.this.getSelectedItemIndex();
- }
-
- public boolean isFontSet() {
- return MenuComponent.this.isFontSet();
- }
-
- @SuppressWarnings("deprecation")
- public FontMetrics getFontMetrics(Font f) {
- return MenuComponent.this.toolkit.getFontMetrics(f);
- }
-
- public Point getLocation() {
- return MenuComponent.this.getLocation();
- }
-
- public MenuItemState getItem(int index) {
- MenuItem item = MenuComponent.this.getItem(index);
- return item.itemState;
- }
-
- public void setSize(int w, int h) {
- this.size = new Dimension(w, h);
- }
-
- void calculate() {
- size = new Dimension();
- size.setSize(toolkit.theme.calculateMenuSize(this));
- }
-
- void reset() {
- for (int i = 0; i < getItemCount(); i++) {
- ((MenuItem.State) getItem(i)).reset();
- }
- }
-
- }
- */
-
- /**
- * Pop-up box for menu. It transfers the paint events,
- * keyboard and mouse events to the menu component itself
- */
- //???AWT
+ * class State implements MenuState { Dimension size; Dimension getSize() {
+ * if (size == null) { calculate(); } return size; } public int getWidth() {
+ * return getSize().width; } public int getHeight() { return
+ * getSize().height; } public Font getFont() { return
+ * MenuComponent.this.getFont(); } public int getItemCount() { return
+ * MenuComponent.this.getItemCount(); } public int getSelectedItemIndex() {
+ * return MenuComponent.this.getSelectedItemIndex(); } public boolean
+ * isFontSet() { return MenuComponent.this.isFontSet(); }
+ * @SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font
+ * f) { return MenuComponent.this.toolkit.getFontMetrics(f); } public Point
+ * getLocation() { return MenuComponent.this.getLocation(); } public
+ * MenuItemState getItem(int index) { MenuItem item =
+ * MenuComponent.this.getItem(index); return item.itemState; } public void
+ * setSize(int w, int h) { this.size = new Dimension(w, h); } void
+ * calculate() { size = new Dimension();
+ * size.setSize(toolkit.theme.calculateMenuSize(this)); } void reset() { for
+ * (int i = 0; i < getItemCount(); i++) { ((MenuItem.State)
+ * getItem(i)).reset(); } } }
+ */
+
+ /**
+ * Pop-up box for menu. It transfers the paint events, keyboard and mouse
+ * events to the menu component itself.
+ */
+ // ???AWT
/*
- class MenuPopupBox extends PopupBox {
- private final Point lastMousePos = new Point();
-
- @Override
- boolean isMenu() {
- return true;
- }
-
- @Override
- void paint(Graphics gr) {
- MenuComponent.this.paint(gr);
- }
-
- @Override
- void onKeyEvent(int eventId, int vKey, long when, int modifiers) {
- MenuComponent.this.onKeyEvent(eventId, vKey, when, modifiers);
- }
+ * class MenuPopupBox extends PopupBox { private final Point lastMousePos =
+ * new Point();
+ * @Override boolean isMenu() { return true; }
+ * @Override void paint(Graphics gr) { MenuComponent.this.paint(gr); }
+ * @Override void onKeyEvent(int eventId, int vKey, long when, int
+ * modifiers) { MenuComponent.this.onKeyEvent(eventId, vKey, when,
+ * modifiers); }
+ * @Override void onMouseEvent(int eventId, Point where, int mouseButton,
+ * long when, int modifiers, int wheelRotation) { // prevent conflict of
+ * mouse and keyboard // when sub-menu drops down due to keyboard navigation
+ * if (lastMousePos.equals(where) && (eventId == MouseEvent.MOUSE_MOVED ||
+ * eventId == MouseEvent.MOUSE_ENTERED)) { return; }
+ * lastMousePos.setLocation(where); MenuComponent.this.onMouseEvent(eventId,
+ * where, mouseButton, when, modifiers); } }
+ */
- @Override
- void onMouseEvent(int eventId, Point where, int mouseButton, long when, int modifiers,
- int wheelRotation) {
- // prevent conflict of mouse and keyboard
- // when sub-menu drops down due to keyboard navigation
- if (lastMousePos.equals(where)
- && (eventId == MouseEvent.MOUSE_MOVED || eventId == MouseEvent.MOUSE_ENTERED)) {
- return;
- }
- lastMousePos.setLocation(where);
- MenuComponent.this.onMouseEvent(eventId, where, mouseButton, when, modifiers);
- }
- }
- */
-
/**
* Instantiates a new MenuComponent object.
*
- * @throws HeadlessException if the graphical interface
- * environment can't support MenuComponents
+ * @throws HeadlessException
+ * if the graphical interface environment can't support
+ * MenuComponents.
*/
public MenuComponent() throws HeadlessException {
toolkit.lockAWT();
@@ -438,9 +238,9 @@ public abstract class MenuComponent implements Serializable {
}
/**
- * Gets the Parent menu Container .
+ * Gets the parent menu container.
*
- * @return the parent
+ * @return the parent.
*/
public MenuContainer getParent() {
toolkit.lockAWT();
@@ -454,7 +254,8 @@ public abstract class MenuComponent implements Serializable {
/**
* Sets the name of the MenuComponent to the specified string.
*
- * @param name the new name of the MenuComponent object.
+ * @param name
+ * the new name of the MenuComponent object.
*/
public void setName(String name) {
toolkit.lockAWT();
@@ -468,7 +269,8 @@ public abstract class MenuComponent implements Serializable {
/**
* Dispatches AWT event.
*
- * @param event the AWTEvent.
+ * @param event
+ * the AWTEvent.
*/
public final void dispatchEvent(AWTEvent event) {
toolkit.lockAWT();
@@ -485,7 +287,8 @@ public abstract class MenuComponent implements Serializable {
/**
* Post deprecated event.
*
- * @param event the event
+ * @param event
+ * the event.
*/
void postDeprecatedEvent(AWTEvent event) {
Event evt = event.getEvent();
@@ -495,11 +298,12 @@ public abstract class MenuComponent implements Serializable {
}
/**
- * Gets the peer of the MenuComponent; an application must not
- * use this method directly.
+ * Gets the peer of the MenuComponent; an application must not use this
+ * method directly.
*
* @return the MenuComponentPeer object.
- *
+ * @throws NotImplementedException
+ * if this method is not implemented by a subclass.
* @deprecated an application must not use this method directly.
*/
@Deprecated
@@ -527,11 +331,9 @@ public abstract class MenuComponent implements Serializable {
/**
* Posts the Event to the MenuComponent.
*
- * @param e the Event.
- *
- * @return true, if the event is posted successfully;
- * false otherwise.
- *
+ * @param e
+ * the Event.
+ * @return true, if the event is posted successfully, false otherwise.
* @deprecated Replaced dispatchEvent method.
*/
@SuppressWarnings("deprecation")
@@ -551,8 +353,7 @@ public abstract class MenuComponent implements Serializable {
/**
* Returns the string representation of the MenuComponent state.
*
- * @return returns the string representation of the MenuComponent
- * state.
+ * @return returns the string representation of the MenuComponent state.
*/
protected String paramString() {
toolkit.lockAWT();
@@ -563,20 +364,13 @@ public abstract class MenuComponent implements Serializable {
}
}
- //???AWT
+ // ???AWT
/*
- public AccessibleContext getAccessibleContext() {
- toolkit.lockAWT();
- try {
- if (accessibleContext == null) {
- accessibleContext = createAccessibleContext();
- }
- return accessibleContext;
- } finally {
- toolkit.unlockAWT();
- }
- }
- */
+ * public AccessibleContext getAccessibleContext() { toolkit.lockAWT(); try
+ * { if (accessibleContext == null) { accessibleContext =
+ * createAccessibleContext(); } return accessibleContext; } finally {
+ * toolkit.unlockAWT(); } }
+ */
/**
* Gets the font of the MenuComponent object.
@@ -605,13 +399,13 @@ public abstract class MenuComponent implements Serializable {
*/
boolean isFontSet() {
return font != null
- || ((parent instanceof MenuComponent) && ((MenuComponent) parent).isFontSet());
+ || ((parent instanceof MenuComponent) && ((MenuComponent)parent).isFontSet());
}
/**
* Checks for default font.
*
- * @return true, if successful
+ * @return true, if successful.
*/
boolean hasDefaultFont() {
return false;
@@ -620,7 +414,8 @@ public abstract class MenuComponent implements Serializable {
/**
* Processes an AWTEevent on this menu component.
*
- * @param event the AWTEvent.
+ * @param event
+ * the AWTEvent.
*/
protected void processEvent(AWTEvent event) {
toolkit.lockAWT();
@@ -645,7 +440,8 @@ public abstract class MenuComponent implements Serializable {
/**
* Sets the Font for this MenuComponent object.
*
- * @param font the new Font to be used for this MenuComponent.
+ * @param font
+ * the new Font to be used for this MenuComponent.
*/
public void setFont(Font font) {
toolkit.lockAWT();
@@ -659,7 +455,8 @@ public abstract class MenuComponent implements Serializable {
/**
* Sets the parent.
*
- * @param parent the new parent
+ * @param parent
+ * the new parent.
*/
void setParent(MenuContainer parent) {
this.parent = parent;
@@ -668,7 +465,7 @@ public abstract class MenuComponent implements Serializable {
/**
* Gets the location.
*
- * @return the location
+ * @return the location.
*/
Point getLocation() {
// to be overridden
@@ -678,7 +475,7 @@ public abstract class MenuComponent implements Serializable {
/**
* Gets the width.
*
- * @return the width
+ * @return the width.
*/
int getWidth() {
// to be overridden
@@ -688,7 +485,7 @@ public abstract class MenuComponent implements Serializable {
/**
* Gets the height.
*
- * @return the height
+ * @return the height.
*/
int getHeight() {
// to be overridden
@@ -698,31 +495,19 @@ public abstract class MenuComponent implements Serializable {
/**
* Recursively find the menu item for a menu shortcut.
*
- * @param gr the gr
- *
- * @return the menu item;
- * or null if the item is not available for this shortcut
+ * @param gr
+ * the gr.
+ * @return the menu item; or null if the item is not available for this
+ * shortcut.
*/
- //???AWT
+ // ???AWT
/*
- MenuItem getShortcutMenuItemImpl(MenuShortcut ms) {
- if (ms == null) {
- return null;
- }
- for (int i = 0; i < getItemCount(); i++) {
- MenuItem mi = getItem(i);
- if (mi instanceof Menu) {
- mi = ((Menu) mi).getShortcutMenuItemImpl(ms);
- if (mi != null) {
- return mi;
- }
- } else if (ms.equals(mi.getShortcut())) {
- return mi;
- }
- }
- return null;
- }
- */
+ * MenuItem getShortcutMenuItemImpl(MenuShortcut ms) { if (ms == null) {
+ * return null; } for (int i = 0; i < getItemCount(); i++) { MenuItem mi =
+ * getItem(i); if (mi instanceof Menu) { mi = ((Menu)
+ * mi).getShortcutMenuItemImpl(ms); if (mi != null) { return mi; } } else if
+ * (ms.equals(mi.getShortcut())) { return mi; } } return null; }
+ */
void paint(Graphics gr) {
gr.setColor(Color.LIGHT_GRAY);
@@ -733,11 +518,16 @@ public abstract class MenuComponent implements Serializable {
/**
* Mouse events handler.
*
- * @param eventId - one of the MouseEvent.MOUSE_* constants
- * @param where - mouse location
- * @param mouseButton - mouse button that was pressed or released
- * @param when - event time
- * @param modifiers - input event modifiers
+ * @param eventId
+ * one of the MouseEvent.MOUSE_* constants.
+ * @param where
+ * mouse location.
+ * @param mouseButton
+ * mouse button that was pressed or released.
+ * @param when
+ * event time.
+ * @param modifiers
+ * input event modifiers.
*/
void onMouseEvent(int eventId, Point where, int mouseButton, long when, int modifiers) {
// to be overridden
@@ -746,159 +536,109 @@ public abstract class MenuComponent implements Serializable {
/**
* Keyboard event handler.
*
- * @param eventId - one of the KeyEvent.KEY_* constants
- * @param vKey - the key code
- * @param when - event time
- * @param modifiers - input event modifiers
+ * @param eventId
+ * one of the KeyEvent.KEY_* constants.
+ * @param vKey
+ * the key code.
+ * @param when
+ * event time.
+ * @param modifiers
+ * input event modifiers.
*/
void onKeyEvent(int eventId, int vKey, long when, int modifiers) {
// to be overridden
}
/**
- * Post the ActionEvent or ItemEvent,
- * depending on type of the menu item.
+ * Post the ActionEvent or ItemEvent, depending on type of the menu item.
*
- * @param index the index
- *
- * @return the item rect
+ * @param index
+ * the index.
+ * @return the item rect.
*/
- //???AWT
+ // ???AWT
/*
- void fireItemAction(int item, long when, int modifiers) {
- MenuItem mi = getItem(item);
- mi.itemSelected(when, modifiers);
- }
-
- MenuItem getItem(int index) {
- // to be overridden
- return null;
- }
-
- int getItemCount() {
- return 0;
- }
- */
+ * void fireItemAction(int item, long when, int modifiers) { MenuItem mi =
+ * getItem(item); mi.itemSelected(when, modifiers); } MenuItem getItem(int
+ * index) { // to be overridden return null; } int getItemCount() { return
+ * 0; }
+ */
/**
- * @return The sub-menu of currently selecetd item,
- * or null if such a sub-menu is not available
+ * @return The sub-menu of currently selecetd item, or null if such a
+ * sub-menu is not available.
*/
- //???AWT
+ // ???AWT
/*
- Menu getSelectedSubmenu() {
- if (selectedItemIndex < 0) {
- return null;
- }
- MenuItem item = getItem(selectedItemIndex);
- return (item instanceof Menu) ? (Menu) item : null;
- }
- */
+ * Menu getSelectedSubmenu() { if (selectedItemIndex < 0) { return null; }
+ * MenuItem item = getItem(selectedItemIndex); return (item instanceof Menu)
+ * ? (Menu) item : null; }
+ */
/**
- * Convenience method for selectItem(index, true)
+ * Convenience method for selectItem(index, true).
*/
- //???AWT
+ // ???AWT
/*
- void selectItem(int index) {
- selectItem(index, true);
- }
- */
+ * void selectItem(int index) { selectItem(index, true); }
+ */
/**
- * Change the selection in the menu
- * @param index - new selecetd item's index
- * @param showSubMenu - if new selected item has a sub-menu,
- * should that sub-menu be displayed
+ * Change the selection in the menu.
+ *
+ * @param index
+ * new selecetd item's index.
+ * @param showSubMenu
+ * if new selected item has a sub-menu, should that sub-menu be
+ * displayed.
*/
- //???AWT
+ // ???AWT
/*
- void selectItem(int index, boolean showSubMenu) {
- if (selectedItemIndex == index) {
- return;
- }
- if (selectedItemIndex >= 0 && getItem(selectedItemIndex) instanceof Menu) {
- ((Menu) getItem(selectedItemIndex)).hide();
- }
- MultiRectArea clip = getUpdateClip(index, selectedItemIndex);
- selectedItemIndex = index;
- Graphics gr = getGraphics(clip);
- if (gr != null) {
- paint(gr);
- }
- if (showSubMenu) {
- showSubMenu(selectedItemIndex);
- }
- }
- */
+ * void selectItem(int index, boolean showSubMenu) { if (selectedItemIndex
+ * == index) { return; } if (selectedItemIndex >= 0 &&
+ * getItem(selectedItemIndex) instanceof Menu) { ((Menu)
+ * getItem(selectedItemIndex)).hide(); } MultiRectArea clip =
+ * getUpdateClip(index, selectedItemIndex); selectedItemIndex = index;
+ * Graphics gr = getGraphics(clip); if (gr != null) { paint(gr); } if
+ * (showSubMenu) { showSubMenu(selectedItemIndex); } }
+ */
/**
* Change the selected item to the next one in the requested direction
* moving cyclically, skipping separators
- * @param forward - the direction to move the selection
- * @param showSubMenu - if new selected item has a sub-menu,
- * should that sub-menu be displayed
+ *
+ * @param forward
+ * the direction to move the selection.
+ * @param showSubMenu
+ * if new selected item has a sub-menu, should that sub-menu be
+ * displayed.
*/
- //???AWT
+ // ???AWT
/*
- void selectNextItem(boolean forward, boolean showSubMenu) {
- int selected = getSelectedItemIndex();
- int count = getItemCount();
- if (count == 0) {
- return;
- }
- if (selected < 0) {
- selected = (forward ? count - 1 : 0);
- }
- int i = selected;
- do {
- i = (forward ? (i + 1) : (i + count - 1)) % count;
- i %= count;
- MenuItem item = getItem(i);
- if (!"-".equals(item.getLabel())) { //$NON-NLS-1$
- selectItem(i, showSubMenu);
- return;
- }
- } while (i != selected);
- }
-
-
- void showSubMenu(int index) {
- if ((index < 0) || !isActive()) {
- return;
- }
- MenuItem item = getItem(index);
- if (item instanceof Menu) {
- Menu menu = ((Menu) getItem(index));
- if (menu.getItemCount() == 0) {
- return;
- }
- Point location = getSubmenuLocation(index);
- menu.show(location.x, location.y, false);
- }
- }
- */
+ * void selectNextItem(boolean forward, boolean showSubMenu) { int selected
+ * = getSelectedItemIndex(); int count = getItemCount(); if (count == 0) {
+ * return; } if (selected < 0) { selected = (forward ? count - 1 : 0); } int
+ * i = selected; do { i = (forward ? (i + 1) : (i + count - 1)) % count; i
+ * %= count; MenuItem item = getItem(i); if (!"-".equals(item.getLabel())) {
+ * //$NON-NLS-1$ selectItem(i, showSubMenu); return; } } while (i !=
+ * selected); } void showSubMenu(int index) { if ((index < 0) ||
+ * !isActive()) { return; } MenuItem item = getItem(index); if (item
+ * instanceof Menu) { Menu menu = ((Menu) getItem(index)); if
+ * (menu.getItemCount() == 0) { return; } Point location =
+ * getSubmenuLocation(index); menu.show(location.x, location.y, false); } }
+ */
/**
- * @return - the menu bar which is the root of crrent menu's hierarchy;
- * or null if the hierarchy root is not a menu bar
+ * @return the menu bar which is the root of current menu's hierarchy; or
+ * null if the hierarchy root is not a menu bar.
*/
- //???AWT
+ // ???AWT
/*
- MenuBar getMenuBar() {
- if (parent instanceof MenuBar) {
- return (MenuBar) parent;
- }
- if (parent instanceof MenuComponent) {
- return ((MenuComponent) parent).getMenuBar();
- }
- return null;
- }
-
- PopupBox getPopupBox() {
- return null;
- }
- */
+ * MenuBar getMenuBar() { if (parent instanceof MenuBar) { return (MenuBar)
+ * parent; } if (parent instanceof MenuComponent) { return ((MenuComponent)
+ * parent).getMenuBar(); } return null; } PopupBox getPopupBox() { return
+ * null; }
+ */
Rectangle getItemRect(int index) {
// to be overridden
@@ -906,13 +646,14 @@ public abstract class MenuComponent implements Serializable {
}
/**
- * Determine the clip region when menu selection is changed
- * from index1 to index2.
- *
- * @param index1 - old selected intem
- * @param index2 - new selected item
+ * Determine the clip region when menu selection is changed from index1 to
+ * index2.
*
- * @return - the region to repaint
+ * @param index1
+ * old selected item.
+ * @param index2
+ * new selected item.
+ * @return the region to repaint.
*/
final MultiRectArea getUpdateClip(int index1, int index2) {
MultiRectArea clip = new MultiRectArea();
@@ -928,9 +669,9 @@ public abstract class MenuComponent implements Serializable {
/**
* Gets the submenu location.
*
- * @param index the index
- *
- * @return the submenu location
+ * @param index
+ * the index.
+ * @return the submenu location.
*/
Point getSubmenuLocation(int index) {
// to be overridden
@@ -940,7 +681,7 @@ public abstract class MenuComponent implements Serializable {
/**
* Gets the selected item index.
*
- * @return the selected item index
+ * @return the selected item index.
*/
int getSelectedItemIndex() {
return selectedItemIndex;
@@ -952,14 +693,15 @@ public abstract class MenuComponent implements Serializable {
void hide() {
selectedItemIndex = -1;
if (parent instanceof MenuComponent) {
- ((MenuComponent) parent).itemHidden(this);
+ ((MenuComponent)parent).itemHidden(this);
}
}
/**
* Item hidden.
*
- * @param mc the mc
+ * @param mc
+ * the mc.
*/
void itemHidden(MenuComponent mc) {
// to be overridden
@@ -968,7 +710,7 @@ public abstract class MenuComponent implements Serializable {
/**
* Checks if is visible.
*
- * @return true, if is visible
+ * @return true, if is visible.
*/
boolean isVisible() {
return true;
@@ -977,7 +719,7 @@ public abstract class MenuComponent implements Serializable {
/**
* Checks if is active.
*
- * @return true, if is active
+ * @return true, if is active.
*/
boolean isActive() {
return true;
@@ -987,14 +729,16 @@ public abstract class MenuComponent implements Serializable {
* Hide all menu hierarchy.
*/
void endMenu() {
- //???AWT: toolkit.dispatcher.popupDispatcher.deactivateAll();
+ // ???AWT: toolkit.dispatcher.popupDispatcher.deactivateAll();
}
/**
* Handle the mouse click or Enter key event on a menu's item.
*
- * @param when - the event time
- * @param modifiers - input event modifiers
+ * @param when
+ * the event time.
+ * @param modifiers
+ * input event modifiers.
*/
void itemSelected(long when, int modifiers) {
endMenu();
@@ -1003,14 +747,14 @@ public abstract class MenuComponent implements Serializable {
/**
* Auto name.
*
- * @return the string
+ * @return the string.
*/
String autoName() {
String name = getClass().getName();
if (name.indexOf("$") != -1) { //$NON-NLS-1$
return null;
}
- //???AWT: int number = toolkit.autoNumber.nextMenuComponent++;
+ // ???AWT: int number = toolkit.autoNumber.nextMenuComponent++;
int number = 0;
name = name.substring(name.lastIndexOf(".") + 1) + Integer.toString(number); //$NON-NLS-1$
return name;
@@ -1019,10 +763,10 @@ public abstract class MenuComponent implements Serializable {
/**
* Creates the Graphics object for the pop-up box of this menu component.
*
- * @param clip - the clip to set on this Graphics
- *
- * @return - the created Graphics object,
- * or null if such object is not available.
+ * @param clip
+ * the clip to set on this Graphics.
+ * @return the created Graphics object, or null if such object is not
+ * available.
*/
Graphics getGraphics(MultiRectArea clip) {
// to be overridden
@@ -1030,12 +774,10 @@ public abstract class MenuComponent implements Serializable {
}
/**
- * @return accessible context specific for particular menu component
+ * @return accessible context specific for particular menu component.
*/
- //???AWT
+ // ???AWT
/*
- AccessibleContext createAccessibleContext() {
- return null;
- }
- */
+ * AccessibleContext createAccessibleContext() { return null; }
+ */
}
diff --git a/awt/java/awt/MenuContainer.java b/awt/java/awt/MenuContainer.java
index 7a48f13c892973ed5402f38c74e904a2e16aa3e5..e509a1b1b7ec6ba6add67326f6787c60af1e3ca4 100644
--- a/awt/java/awt/MenuContainer.java
+++ b/awt/java/awt/MenuContainer.java
@@ -18,17 +18,21 @@
* @author Pavel Dolgov
* @version $Revision$
*/
+
package java.awt;
/**
* The MenuContainer interface represents all menu containers.
+ *
+ * @since Android 1.0
*/
public interface MenuContainer {
/**
* Removes the specified MenuComponent from the MenuContainer.
*
- * @param c the MenuComponent.
+ * @param c
+ * the MenuComponent.
*/
public void remove(MenuComponent c);
@@ -42,15 +46,12 @@ public interface MenuContainer {
/**
* Posts an Event.
*
- * @param e the Event.
- *
- * @return true if the event is posted successfully;
- * false otherwise.
- *
+ * @param e
+ * the Event.
+ * @return true if the event is posted successfully, false otherwise.
* @deprecated Replaced by dispatchEvent method.
*/
@Deprecated
public boolean postEvent(Event e);
}
-
diff --git a/awt/java/awt/Paint.java b/awt/java/awt/Paint.java
index f8732c8efed37224c47156c81521efd39ec4cd20..dfea3a74bfed1961e058164e79e37c34dca50a5e 100644
--- a/awt/java/awt/Paint.java
+++ b/awt/java/awt/Paint.java
@@ -18,6 +18,7 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.geom.AffineTransform;
@@ -25,28 +26,32 @@ import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;
/**
- * The Paint interface provides possibility of generating
- * color patterns in device space for fill, draw, or stroke operations
- * in a Graphics2D.
+ * The Paint interface provides possibility of generating color patterns in
+ * device space for fill, draw, or stroke operations in a Graphics2D.
+ *
+ * @since Android 1.0
*/
public interface Paint extends Transparency {
-
+
/**
- * Creates the PaintContext which is used to generate color
- * patterns for rendering operations of Graphics2D.
- *
- * @param cm the ColorModel object, or null.
- * @param deviceBounds the Rectangle represents the bounding box of
- * device space for the graphics rendering operations.
- * @param userBounds the Rectangle represents bounding box of
- * user space for the graphics rendering operations.
- * @param xform the AffineTransform for translation from user space
- * to device space.
- * @param hints the RenderingHints preferences.
+ * Creates the PaintContext which is used to generate color patterns for
+ * rendering operations of Graphics2D.
*
+ * @param cm
+ * the ColorModel object, or null.
+ * @param deviceBounds
+ * the Rectangle represents the bounding box of device space for
+ * the graphics rendering operations.
+ * @param userBounds
+ * the Rectangle represents bounding box of user space for the
+ * graphics rendering operations.
+ * @param xform
+ * the AffineTransform for translation from user space to device
+ * space.
+ * @param hints
+ * the RenderingHints preferences.
* @return the PaintContext for generating color patterns.
*/
- PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
- Rectangle2D userBounds, AffineTransform xform,
- RenderingHints hints);
+ PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds,
+ AffineTransform xform, RenderingHints hints);
}
diff --git a/awt/java/awt/PaintContext.java b/awt/java/awt/PaintContext.java
index 647de8bbbc889e46931540b31b7a16a4c92dce11..966b6ca99e8254dff623c8d3c56a368b2321a39b 100644
--- a/awt/java/awt/PaintContext.java
+++ b/awt/java/awt/PaintContext.java
@@ -18,20 +18,22 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.image.ColorModel;
import java.awt.image.Raster;
/**
- * The PaintContext interface determines the specific environment for
- * generating color patterns in device space for fill, draw, or stroke
- * rendering operations using Graphics2D. This interface provides colors
- * through the Raster object associated with the specific ColorModel
- * for Graphics2D rendering operations.
+ * The PaintContext interface determines the specific environment for generating
+ * color patterns in device space for fill, draw, or stroke rendering operations
+ * using Graphics2D. This interface provides colors through the Raster object
+ * associated with the specific ColorModel for Graphics2D rendering operations.
+ *
+ * @since Android 1.0
*/
public interface PaintContext {
-
+
/**
* Releases the resources allocated for the operation.
*/
@@ -45,20 +47,23 @@ public interface PaintContext {
ColorModel getColorModel();
/**
- * Gets the Raster which defines the colors of the specified rectangular
+ * Gets the Raster which defines the colors of the specified rectangular
* area for Graphics2D rendering operations.
*
- * @param x the X coordinate of the device space area for which
- * colors are generated.
- * @param y the Y coordinate of the device space area for which
- * colors are generated.
- * @param w the width of the device space area for which
- * colors are generated.
- * @param h the height of the device space area for which
- * colors are generated.
- *
- * @return the Raster object which contains the colors of the specified
- * rectangular area for Graphics2D rendering operations.
+ * @param x
+ * the X coordinate of the device space area for which colors are
+ * generated.
+ * @param y
+ * the Y coordinate of the device space area for which colors are
+ * generated.
+ * @param w
+ * the width of the device space area for which colors are
+ * generated.
+ * @param h
+ * the height of the device space area for which colors are
+ * generated.
+ * @return the Raster object which contains the colors of the specified
+ * rectangular area for Graphics2D rendering operations.
*/
Raster getRaster(int x, int y, int w, int h);
}
diff --git a/awt/java/awt/Point.java b/awt/java/awt/Point.java
index 99418ed8a74c4dedda09370664de8cab3ed250e4..8ec424121513a3b8b574d55097a4eb459cc4f483 100644
--- a/awt/java/awt/Point.java
+++ b/awt/java/awt/Point.java
@@ -18,28 +18,37 @@
* @author Denis M. Kishenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.geom.Point2D;
import java.io.Serializable;
/**
- * The Point class represents a point location with coordinates X, Y in
- * current coordinate system.
+ * The Point class represents a point location with coordinates X, Y in current
+ * coordinate system.
+ *
+ * @since Android 1.0
*/
public class Point extends Point2D implements Serializable {
- /** The Constant serialVersionUID. */
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -5276940640259749850L;
- /** The X coordinate of Point. */
+ /**
+ * The X coordinate of Point.
+ */
public int x;
-
- /** The Y coordinate of Point. */
+
+ /**
+ * The Y coordinate of Point.
+ */
public int y;
/**
- * Instantiates a new point with (0, O) coordinates, the origin of
+ * Instantiates a new point with (0, O) coordinates, the origin of
* coordinate system.
*/
public Point() {
@@ -49,18 +58,20 @@ public class Point extends Point2D implements Serializable {
/**
* Instantiates a new point with (x, y) coordinates.
*
- * @param x the X coordinate of Point.
- * @param y the Y coordinate of Point.
+ * @param x
+ * the X coordinate of Point.
+ * @param y
+ * the Y coordinate of Point.
*/
public Point(int x, int y) {
setLocation(x, y);
}
/**
- * Instantiates a new point, giving it the same locaion as
- * the parameter p.
+ * Instantiates a new point, giving it the same location as the parameter p.
*
- * @param p the Point object giving the coordinates of the new point.
+ * @param p
+ * the Point object giving the coordinates of the new point.
*/
public Point(Point p) {
setLocation(p.x, p.y);
@@ -69,12 +80,10 @@ public class Point extends Point2D implements Serializable {
/**
* Compares current Point with the specified object.
*
- * @param obj the Object to be compared.
- *
- * @return true, if the Object being compared is a Point
- * whose coordinates are equal to the coordinates of this
- * Point, otherwise false.
- *
+ * @param obj
+ * the Object to be compared.
+ * @return true, if the Object being compared is a Point whose coordinates
+ * are equal to the coordinates of this Point, false otherwise.
* @see java.awt.geom.Point2D#equals(Object)
*/
@Override
@@ -103,7 +112,6 @@ public class Point extends Point2D implements Serializable {
* Gets X coordinate of Point as a double.
*
* @return X coordinate of the point as a double.
- *
* @see java.awt.geom.Point2D#getX()
*/
@Override
@@ -115,7 +123,6 @@ public class Point extends Point2D implements Serializable {
* Gets Y coordinate of Point as a double.
*
* @return Y coordinate of the point as a double.
- *
* @see java.awt.geom.Point2D#getY()
*/
@Override
@@ -135,7 +142,8 @@ public class Point extends Point2D implements Serializable {
/**
* Sets the location of the Point to the same coordinates as p.
*
- * @param p the Point that gives the new location.
+ * @param p
+ * the Point that gives the new location.
*/
public void setLocation(Point p) {
setLocation(p.x, p.y);
@@ -144,8 +152,10 @@ public class Point extends Point2D implements Serializable {
/**
* Sets the location of the Point to the coordinates X, Y.
*
- * @param x the X coordinate of the Point's new location.
- * @param y the Y coordinate of the Point's new location.
+ * @param x
+ * the X coordinate of the Point's new location.
+ * @param y
+ * the Y coordinate of the Point's new location.
*/
public void setLocation(int x, int y) {
this.x = x;
@@ -155,36 +165,43 @@ public class Point extends Point2D implements Serializable {
/**
* Sets the location of Point to the specified double coordinates.
*
- * @param x the X the Point's new location.
- * @param y the Y the Point's new location.
- *
+ * @param x
+ * the X the Point's new location.
+ * @param y
+ * the Y the Point's new location.
* @see java.awt.geom.Point2D#setLocation(double, double)
*/
@Override
public void setLocation(double x, double y) {
- x = x < Integer.MIN_VALUE ? Integer.MIN_VALUE : x > Integer.MAX_VALUE ? Integer.MAX_VALUE : x;
- y = y < Integer.MIN_VALUE ? Integer.MIN_VALUE : y > Integer.MAX_VALUE ? Integer.MAX_VALUE : y;
+ x = x < Integer.MIN_VALUE ? Integer.MIN_VALUE : x > Integer.MAX_VALUE ? Integer.MAX_VALUE
+ : x;
+ y = y < Integer.MIN_VALUE ? Integer.MIN_VALUE : y > Integer.MAX_VALUE ? Integer.MAX_VALUE
+ : y;
setLocation((int)Math.round(x), (int)Math.round(y));
}
/**
* Moves the Point to the specified (x, y) location.
*
- * @param x the X coordinate of the new location.
- * @param y the Y coordinate of the new location.
+ * @param x
+ * the X coordinate of the new location.
+ * @param y
+ * the Y coordinate of the new location.
*/
public void move(int x, int y) {
setLocation(x, y);
}
/**
- * Translates current Point moving it from the position (x, y)
- * to the new position given by (x+dx, x+dy) coordinates.
- *
- * @param dx the horizontal delta - the Point is moved to this distance along
- * X axis.
- * @param dy the vertical delta - the Point is moved to this distance along
- * Y axis.
+ * Translates current Point moving it from the position (x, y) to the new
+ * position given by (x+dx, x+dy) coordinates.
+ *
+ * @param dx
+ * the horizontal delta - the Point is moved to this distance
+ * along X axis.
+ * @param dy
+ * the vertical delta - the Point is moved to this distance along
+ * Y axis.
*/
public void translate(int dx, int dy) {
x += dx;
@@ -192,4 +209,3 @@ public class Point extends Point2D implements Serializable {
}
}
-
diff --git a/awt/java/awt/Polygon.java b/awt/java/awt/Polygon.java
index 6f3fc9778c918af1c6044e4428388ee57fc21b18..de31eb989229ff2e9201b13c05f2786331fa16a6 100644
--- a/awt/java/awt/Polygon.java
+++ b/awt/java/awt/Polygon.java
@@ -18,6 +18,7 @@
* @author Denis M. Kishenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.Point;
@@ -34,57 +35,78 @@ import org.apache.harmony.awt.gl.*;
import org.apache.harmony.awt.internal.nls.Messages;
/**
- * The Polygon class defines an closed area specified by n vertices and
- * n edges. The coordinates of the vertices are specified by x, y arrays.
- * The edges are the line segments from the point (x[i], y[i]) to the point
- * (x[i+1], y[i+1]), for -1 < i < (n-1) plus the line segment from
- * the point (x[n-1], y[n-1]) to the point (x[0], y[0]) point.
- * The Polygon is empty if the number of vertices is zero.
+ * The Polygon class defines an closed area specified by n vertices and n edges.
+ * The coordinates of the vertices are specified by x, y arrays. The edges are
+ * the line segments from the point (x[i], y[i]) to the point (x[i+1], y[i+1]),
+ * for -1 < i < (n-1) plus the line segment from the point (x[n-1], y[n-1]) to
+ * the point (x[0], y[0]) point. The Polygon is empty if the number of vertices
+ * is zero.
+ *
+ * @since Android 1.0
*/
public class Polygon implements Shape, Serializable {
- /** The Constant serialVersionUID. */
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -6460061437900069969L;
- /** The points buffer capacity. */
+ /**
+ * The points buffer capacity.
+ */
private static final int BUFFER_CAPACITY = 4;
-
- /** The number of Polygon vertices.*/
+
+ /**
+ * The number of Polygon vertices.
+ */
public int npoints;
-
- /** The array of X coordinates of the vertices. */
+
+ /**
+ * The array of X coordinates of the vertices.
+ */
public int[] xpoints;
-
- /** The array of Y coordinates of the vertices. */
+
+ /**
+ * The array of Y coordinates of the vertices.
+ */
public int[] ypoints;
-
- /**
- * The smallest Rectangle that completely contains this Polygon.
+
+ /**
+ * The smallest Rectangle that completely contains this Polygon.
*/
protected Rectangle bounds;
/*
- * Polygon path iterator
+ * Polygon path iterator
*/
/**
* The internal Class Iterator.
*/
class Iterator implements PathIterator {
- /** The source Polygon object. */
+ /**
+ * The source Polygon object.
+ */
public Polygon p;
-
- /** The path iterator transformation. */
+
+ /**
+ * The path iterator transformation.
+ */
public AffineTransform t;
-
- /** The current segmenet index. */
+
+ /**
+ * The current segment index.
+ */
public int index;
/**
- * Constructs a new Polygon.Iterator for the given polygon and transformation
+ * Constructs a new Polygon.Iterator for the given polygon and
+ * transformation
*
- * @param at - the AffineTransform object to apply rectangle path
- * @param p the p
+ * @param at
+ * the AffineTransform object to apply rectangle path.
+ * @param p
+ * the p.
*/
public Iterator(AffineTransform at, Polygon p) {
this.p = p;
@@ -148,18 +170,21 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Instantiates a new polygon with the specified number of vertices,
- * and the given arrays of x, y vertex coordinates. The length of
- * each coordinate array may not be less than the specified number of
- * vertices but may be greater. Only the first n elements are used from
- * each coordinate array.
- *
- * @param xpoints the array of X vertex coordinates.
- * @param ypoints the array of Y vertex coordinates.
- * @param npoints the number vertices of the polygon.
- * @throws IndexOutOfBoundsException if the length of xpoints or ypoints
- * is less than n.
- * @throws NegativeArraySizeException if n is negative.
+ * Instantiates a new polygon with the specified number of vertices, and the
+ * given arrays of x, y vertex coordinates. The length of each coordinate
+ * array may not be less than the specified number of vertices but may be
+ * greater. Only the first n elements are used from each coordinate array.
+ *
+ * @param xpoints
+ * the array of X vertex coordinates.
+ * @param ypoints
+ * the array of Y vertex coordinates.
+ * @param npoints
+ * the number vertices of the polygon.
+ * @throws IndexOutOfBoundsException
+ * if the length of xpoints or ypoints is less than n.
+ * @throws NegativeArraySizeException
+ * if n is negative.
*/
public Polygon(int[] xpoints, int[] ypoints, int npoints) {
if (npoints > xpoints.length || npoints > ypoints.length) {
@@ -178,9 +203,9 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Resets the current Polygon to an empty Polygon. More precisely,
- * the number of Polygon vertices is set to zero, but x, y coordinates
- * arrays are not affected.
+ * Resets the current Polygon to an empty Polygon. More precisely, the
+ * number of Polygon vertices is set to zero, but x, y coordinates arrays
+ * are not affected.
*/
public void reset() {
npoints = 0;
@@ -188,21 +213,22 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Invalidates the data that depends on the vertex coordinates.
- * This method should be called after direct manipulations
- * of the x, y vertex coordinates arrays to avoid unpredictable
- * results of methods which rely on the bounding box.
+ * Invalidates the data that depends on the vertex coordinates. This method
+ * should be called after direct manipulations of the x, y vertex
+ * coordinates arrays to avoid unpredictable results of methods which rely
+ * on the bounding box.
*/
public void invalidate() {
bounds = null;
}
/**
- * Adds the point to the Polygon and updates the bounding box
- * accordingly.
+ * Adds the point to the Polygon and updates the bounding box accordingly.
*
- * @param px the X coordinate of the added vertex.
- * @param py the Y coordinate of the added vertex.
+ * @param px
+ * the X coordinate of the added vertex.
+ * @param py
+ * the Y coordinate of the added vertex.
*/
public void addPoint(int px, int py) {
if (npoints == xpoints.length) {
@@ -222,20 +248,16 @@ public class Polygon implements Shape, Serializable {
npoints++;
if (bounds != null) {
- bounds.setFrameFromDiagonal(
- Math.min(bounds.getMinX(), px),
- Math.min(bounds.getMinY(), py),
- Math.max(bounds.getMaxX(), px),
- Math.max(bounds.getMaxY(), py));
+ bounds.setFrameFromDiagonal(Math.min(bounds.getMinX(), px), Math.min(bounds.getMinY(),
+ py), Math.max(bounds.getMaxX(), px), Math.max(bounds.getMaxY(), py));
}
}
/**
- * Gets the bounding rectangle of the Polygon. The bounding rectangle
- * is the smallest rectangle which contains the Polygon.
+ * Gets the bounding rectangle of the Polygon. The bounding rectangle is the
+ * smallest rectangle which contains the Polygon.
*
* @return the bounding rectangle of the Polygon.
- *
* @see java.awt.Shape#getBounds()
*/
public Rectangle getBounds() {
@@ -270,11 +292,10 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Gets the bounding rectangle of the Polygon. The bounding rectangle
- * is the smallest rectangle which contains the Polygon.
+ * Gets the bounding rectangle of the Polygon. The bounding rectangle is the
+ * smallest rectangle which contains the Polygon.
*
* @return the bounding rectangle of the Polygon.
- *
* @deprecated Use getBounds() method.
*/
@Deprecated
@@ -283,12 +304,10 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Gets the Rectangle2D which represents Polygon bounds.
- * The bounding rectangle is the smallest rectangle which contains
- * the Polygon.
+ * Gets the Rectangle2D which represents Polygon bounds. The bounding
+ * rectangle is the smallest rectangle which contains the Polygon.
*
* @return the bounding rectangle of the Polygon.
- *
* @see java.awt.Shape#getBounds2D()
*/
public Rectangle2D getBounds2D() {
@@ -296,11 +315,13 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Translates all vertices of Polygon the specified distances
- * along X, Y axis.
+ * Translates all vertices of Polygon the specified distances along X, Y
+ * axis.
*
- * @param mx the distance to translate horizontally.
- * @param my the distance to translate vertically.
+ * @param mx
+ * the distance to translate horizontally.
+ * @param my
+ * the distance to translate vertically.
*/
public void translate(int mx, int my) {
for (int i = 0; i < npoints; i++) {
@@ -313,46 +334,47 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Checks whether or not the point given by the coordinates x, y lies inside
+ * Checks whether or not the point given by the coordinates x, y lies inside
* the Polygon.
*
- * @param x the X coordinate of the point to check.
- * @param y the Y coordinate of the point to check.
- *
- * @return true, if the specified point lies inside the Polygon,
- * otherwise false.
- *
+ * @param x
+ * the X coordinate of the point to check.
+ * @param y
+ * the Y coordinate of the point to check.
+ * @return true, if the specified point lies inside the Polygon, false
+ * otherwise.
* @deprecated Use contains(int, int) method.
*/
@Deprecated
public boolean inside(int x, int y) {
- return contains((double) x, (double) y);
+ return contains((double)x, (double)y);
}
/**
- * Checks whether or not the point given by the coordinates x, y lies inside
+ * Checks whether or not the point given by the coordinates x, y lies inside
* the Polygon.
*
- * @param x the X coordinate of the point to check.
- * @param y the Y coordinate of the point to check.
- *
- * @return true, if the specified point lies inside the Polygon,
- * otherwise false.
+ * @param x
+ * the X coordinate of the point to check.
+ * @param y
+ * the Y coordinate of the point to check.
+ * @return true, if the specified point lies inside the Polygon, false
+ * otherwise.
*/
public boolean contains(int x, int y) {
- return contains((double) x, (double) y);
+ return contains((double)x, (double)y);
}
/**
- * Checks whether or not the point with specified double coordinates
- * lies inside the Polygon.
- *
- * @param x the X coordinate of the point to check.
- * @param y the Y coordinate of the point to check.
- *
- * @return true, if the point given by the double coordinates
- * lies inside the Polygon, otherwise false.
- *
+ * Checks whether or not the point with specified double coordinates lies
+ * inside the Polygon.
+ *
+ * @param x
+ * the X coordinate of the point to check.
+ * @param y
+ * the Y coordinate of the point to check.
+ * @return true, if the point given by the double coordinates lies inside
+ * the Polygon, false otherwise.
* @see java.awt.Shape#contains(double, double)
*/
public boolean contains(double x, double y) {
@@ -360,19 +382,21 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Checks whether or not the rectangle determined by the parameters
- * [x, y, width, height] lies inside the Polygon.
- *
- * @param x the X coordinate of the rectangles's left upper
- * corner as a double.
- * @param y the Y coordinate of the rectangles's left upper
- * corner as a double.
- * @param width the width of rectangle as a double.
- * @param width the height of rectangle as a double.
- *
- * @return true, if the specified rectangle lies inside the Polygon,
- * otherwise false.
- *
+ * Checks whether or not the rectangle determined by the parameters [x, y,
+ * width, height] lies inside the Polygon.
+ *
+ * @param x
+ * the X coordinate of the rectangles's left upper corner as a
+ * double.
+ * @param y
+ * the Y coordinate of the rectangles's left upper corner as a
+ * double.
+ * @param width
+ * the width of rectangle as a double.
+ * @param height
+ * the height of rectangle as a double.
+ * @return true, if the specified rectangle lies inside the Polygon, false
+ * otherwise.
* @see java.awt.Shape#contains(double, double, double, double)
*/
public boolean contains(double x, double y, double width, double height) {
@@ -381,20 +405,21 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Checks whether or not the rectangle determined by the parameters
- * [x, y, width, height] intersects the interior of
- * the Polygon.
- *
- * @param x the X coordinate of the rectangles's left upper
- * corner as a double.
- * @param y the Y coordinate of the rectangles's left upper
- * corner as a double.
- * @param width the width of rectangle as a double.
- * @param width the height of rectangle as a double.
- *
- * @return true, if the specified rectangle intersects the interior of
- * the Polygon, otherwise false.
- *
+ * Checks whether or not the rectangle determined by the parameters [x, y,
+ * width, height] intersects the interior of the Polygon.
+ *
+ * @param x
+ * the X coordinate of the rectangles's left upper corner as a
+ * double.
+ * @param y
+ * the Y coordinate of the rectangles's left upper corner as a
+ * double.
+ * @param width
+ * the width of rectangle as a double.
+ * @param height
+ * the height of rectangle as a double.
+ * @return true, if the specified rectangle intersects the interior of the
+ * Polygon, false otherwise.
* @see java.awt.Shape#intersects(double, double, double, double)
*/
public boolean intersects(double x, double y, double width, double height) {
@@ -405,11 +430,10 @@ public class Polygon implements Shape, Serializable {
/**
* Checks whether or not the specified rectangle lies inside the Polygon.
*
- * @param rect the Rectangle2D object.
- *
- * @return true, if the specified rectangle lies inside the Polygon,
- * otherwise false.
- *
+ * @param rect
+ * the Rectangle2D object.
+ * @return true, if the specified rectangle lies inside the Polygon, false
+ * otherwise.
* @see java.awt.Shape#contains(java.awt.geom.Rectangle2D)
*/
public boolean contains(Rectangle2D rect) {
@@ -419,10 +443,10 @@ public class Polygon implements Shape, Serializable {
/**
* Checks whether or not the specified Point lies inside the Polygon.
*
- * @param point the Point object.
- *
- * @return true, if the specified Point lies inside the Polygon,
- * otherwise false.
+ * @param point
+ * the Point object.
+ * @return true, if the specified Point lies inside the Polygon, false
+ * otherwise.
*/
public boolean contains(Point point) {
return contains(point.getX(), point.getY());
@@ -431,11 +455,10 @@ public class Polygon implements Shape, Serializable {
/**
* Checks whether or not the specified Point2D lies inside the Polygon.
*
- * @param point the Point2D object.
- *
- * @return true, if the specified Point2D lies inside the Polygon,
- * otherwise false.
- *
+ * @param point
+ * the Point2D object.
+ * @return true, if the specified Point2D lies inside the Polygon, false
+ * otherwise.
* @see java.awt.Shape#contains(java.awt.geom.Point2D)
*/
public boolean contains(Point2D point) {
@@ -443,14 +466,13 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Checks whether or not the interior of rectangle specified by
- * the Rectangle2D object intersects the interior of the Polygon.
- *
- * @param rect the Rectangle2D object.
- *
- * @return true, if the Rectangle2D intersects the interior of
- * the Polygon, otherwise false.
+ * Checks whether or not the interior of rectangle specified by the
+ * Rectangle2D object intersects the interior of the Polygon.
*
+ * @param rect
+ * the Rectangle2D object.
+ * @return true, if the Rectangle2D intersects the interior of the Polygon,
+ * false otherwise.
* @see java.awt.Shape#intersects(java.awt.geom.Rectangle2D)
*/
public boolean intersects(Rectangle2D rect) {
@@ -458,13 +480,12 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Gets the PathIterator object which gives the coordinates of
- * the polygon, transformed according to the specified AffineTransform.
- *
- * @param t the specified AffineTransform object, or null.
+ * Gets the PathIterator object which gives the coordinates of the polygon,
+ * transformed according to the specified AffineTransform.
*
+ * @param t
+ * the specified AffineTransform object or null.
* @return PathIterator object for the Polygon.
- *
* @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform)
*/
public PathIterator getPathIterator(AffineTransform t) {
@@ -472,23 +493,23 @@ public class Polygon implements Shape, Serializable {
}
/**
- * Gets the PathIterator object which gives the coordinates of
- * the polygon, transformed according to the specified AffineTransform.
- * The flatness parameter is ignored.
- *
- * @param t the specified AffineTransform object, or null.
- * @param flatness the maximum number of the control points for
- * a given curve which varies from colinear before a subdivided curve
- * is replaced by a straight line connecting the endpoints.
- * This parameter is ignored for the Polygon class.
- *
+ * Gets the PathIterator object which gives the coordinates of the polygon,
+ * transformed according to the specified AffineTransform. The flatness
+ * parameter is ignored.
+ *
+ * @param t
+ * the specified AffineTransform object or null.
+ * @param flatness
+ * the maximum number of the control points for a given curve
+ * which varies from colinear before a subdivided curve is
+ * replaced by a straight line connecting the endpoints. This
+ * parameter is ignored for the Polygon class.
* @return PathIterator object for the Polygon.
- *
- * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform, double)
+ * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform,
+ * double)
*/
public PathIterator getPathIterator(AffineTransform t, double flatness) {
return new Iterator(t, this);
}
}
-
diff --git a/awt/java/awt/Rectangle.java b/awt/java/awt/Rectangle.java
index 86c4dfca0d1ee175f02938e8a3d451188f6d9181..d8ebb3ad19eb94b4870aeb2a6443ba10e28c5015 100644
--- a/awt/java/awt/Rectangle.java
+++ b/awt/java/awt/Rectangle.java
@@ -18,36 +18,48 @@
* @author Denis M. Kishenko
* @version $Revision$
*/
+
package java.awt;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
/**
- * The Rectangle class defines the rectangular area in terms of its
- * upper left corner coordinates [x,y], its width, and its height.
- * A Rectangle specified by [x, y, width, height] parameters has an
- * outline path with corners at [x, y], [x + width,y], [x + width,y + height],
- * and [x, y + height].
- *
- * The rectangle is empty if the width or height is negative or zero.
- * In this case the isEmpty method returns true.
+ * The Rectangle class defines the rectangular area in terms of its upper left
+ * corner coordinates [x,y], its width, and its height. A Rectangle specified by
+ * [x, y, width, height] parameters has an outline path with corners at [x, y],
+ * [x + width,y], [x + width,y + height], and [x, y + height].
+ *
+ * The rectangle is empty if the width or height is negative or zero. In this
+ * case the isEmpty method returns true.
+ *
+ * @since Android 1.0
*/
public class Rectangle extends Rectangle2D implements Shape, Serializable {
- /** The Constant serialVersionUID. */
+ /**
+ * The Constant serialVersionUID.
+ */
private static final long serialVersionUID = -4345857070255674764L;
- /** The X coordinate of the rectangle's left upper corner. */
+ /**
+ * The X coordinate of the rectangle's left upper corner.
+ */
public int x;
-
- /** The Y coordinate of the rectangle's left upper corner. */
+
+ /**
+ * The Y coordinate of the rectangle's left upper corner.
+ */
public int y;
-
- /** The width of rectangle. */
+
+ /**
+ * The width of rectangle.
+ */
public int width;
-
- /** The height of rectangle. */
+
+ /**
+ * The height of rectangle.
+ */
public int height;
/**
@@ -60,73 +72,82 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Instantiates a new rectangle whose upper left corner coordinates are
- * given by the Point object (p.X and p.Y), and the width and
- * the height are zero.
+ * given by the Point object (p.X and p.Y), and the width and the height are
+ * zero.
*
- * @param p the Point specifies the upper left corner coordinates of
- * the rectangle.
+ * @param p
+ * the Point specifies the upper left corner coordinates of the
+ * rectangle.
*/
public Rectangle(Point p) {
setBounds(p.x, p.y, 0, 0);
}
/**
- * Instantiates a new rectangle whose upper left corner coordinates are
- * given by the Point object (p.X and p.Y), and the width and the height
- * are given by Dimension object (d.width and d.height).
+ * Instantiates a new rectangle whose upper left corner coordinates are
+ * given by the Point object (p.X and p.Y), and the width and the height are
+ * given by Dimension object (d.width and d.height).
*
- * @param p the Point specifies the upper left corner coordinates of
- * the rectangle.
- * @param d the Dimention specifies the width and the height of the rectangle.
+ * @param p
+ * the point specifies the upper left corner coordinates of the
+ * rectangle.
+ * @param d
+ * the dimension specifies the width and the height of the
+ * rectangle.
*/
public Rectangle(Point p, Dimension d) {
setBounds(p.x, p.y, d.width, d.height);
}
/**
- * Instantiates a new rectangle determined by the upper left corner
+ * Instantiates a new rectangle determined by the upper left corner
* coordinates (x, y), width and height.
*
- * @param x the X upper left corner coordinate of the rectangle.
- * @param y the Y upper left corner coordinate of the rectangle.
- * @param width the width of rectangle.
- * @param height the height of rectangle.
+ * @param x
+ * the X upper left corner coordinate of the rectangle.
+ * @param y
+ * the Y upper left corner coordinate of the rectangle.
+ * @param width
+ * the width of rectangle.
+ * @param height
+ * the height of rectangle.
*/
public Rectangle(int x, int y, int width, int height) {
setBounds(x, y, width, height);
}
/**
- * Instantiates a new rectangle with [0, 0] as its upper left
- * corner coordinates and the specified width and height.
+ * Instantiates a new rectangle with [0, 0] as its upper left corner
+ * coordinates and the specified width and height.
*
- * @param width the width of rectangle.
- * @param height the height of rectangle.
+ * @param width
+ * the width of rectangle.
+ * @param height
+ * the height of rectangle.
*/
public Rectangle(int width, int height) {
setBounds(0, 0, width, height);
}
/**
- * Instantiates a new rectangle with the same coordinates
- * as the given source rectangle.
+ * Instantiates a new rectangle with the same coordinates as the given
+ * source rectangle.
*
- * @param r the Rectangle object which parameters will be used for
- * instantiating a new Rectangle.
+ * @param r
+ * the Rectangle object which parameters will be used for
+ * instantiating a new Rectangle.
*/
public Rectangle(Rectangle r) {
setBounds(r.x, r.y, r.width, r.height);
}
-/*
- public Rectangle(Dimension d) {
- setBounds(0, 0, d.width, d.height);
- }
-*/
+
+ /*
+ * public Rectangle(Dimension d) { setBounds(0, 0, d.width, d.height); }
+ */
/**
* Gets the X coordinate of bound as a double.
*
* @return the X coordinate of bound as a double.
- *
* @see java.awt.geom.RectangularShape#getX()
*/
@Override
@@ -138,7 +159,6 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
* Gets the Y coordinate of bound as a double.
*
* @return the Y coordinate of bound as a double.
- *
* @see java.awt.geom.RectangularShape#getY()
*/
@Override
@@ -149,8 +169,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Gets the height of the rectangle as a double.
*
- * @return the height of the rectangle as a double.
- *
+ * @return the height of the rectangle as a double.
* @see java.awt.geom.RectangularShape#getHeight()
*/
@Override
@@ -162,7 +181,6 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
* Gets the width of the rectangle as a double.
*
* @return the width of the rectangle as a double.
- *
* @see java.awt.geom.RectangularShape#getWidth()
*/
@Override
@@ -171,11 +189,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Determines whether or not the rectangle is empty. The rectangle is empty if
- * its width or height is negative or zero.
+ * Determines whether or not the rectangle is empty. The rectangle is empty
+ * if its width or height is negative or zero.
*
* @return true, if the rectangle is empty, otherwise false.
- *
* @see java.awt.geom.RectangularShape#isEmpty()
*/
@Override
@@ -184,9 +201,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Gets the size of a Rectangle as Dimention object.
+ * Gets the size of a Rectangle as Dimension object.
*
- * @return a Dimention object which represents size of the rectangle.
+ * @return a Dimension object which represents size of the rectangle.
*/
public Dimension getSize() {
return new Dimension(width, height);
@@ -195,8 +212,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Sets the size of the Rectangle.
*
- * @param width the new width of the rectangle.
- * @param height the new height of the rectangle.
+ * @param width
+ * the new width of the rectangle.
+ * @param height
+ * the new height of the rectangle.
*/
public void setSize(int width, int height) {
this.width = width;
@@ -206,7 +225,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Sets the size of a Rectangle specified as Dimension object.
*
- * @param d a Dimension object which represents new size of a rectangle.
+ * @param d
+ * a Dimension object which represents new size of a rectangle.
*/
public void setSize(Dimension d) {
setSize(d.width, d.height);
@@ -215,19 +235,21 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Gets the location of a rectangle's upper left corner as a Point object.
*
- * @return the Point object with coordinates equal to the upper left corner
- * of the rectangle.
+ * @return the Point object with coordinates equal to the upper left corner
+ * of the rectangle.
*/
public Point getLocation() {
return new Point(x, y);
}
/**
- * Sets the location of the rectangle in terms of its upper left
- * corner coordinates X and Y.
+ * Sets the location of the rectangle in terms of its upper left corner
+ * coordinates X and Y.
*
- * @param x the X coordinate of the rectangle's upper left corner.
- * @param y the Y coordinate of the rectangle's upper left corner.
+ * @param x
+ * the X coordinate of the rectangle's upper left corner.
+ * @param y
+ * the Y coordinate of the rectangle's upper left corner.
*/
public void setLocation(int x, int y) {
this.x = x;
@@ -235,23 +257,25 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Sets the location of a rectangle using a Point object to give the
+ * Sets the location of a rectangle using a Point object to give the
* coordinates of the upper left corner.
*
- * @param p the Point object which represents the new upper left corner
- * coordinates of rectangle.
+ * @param p
+ * the Point object which represents the new upper left corner
+ * coordinates of rectangle.
*/
public void setLocation(Point p) {
setLocation(p.x, p.y);
}
/**
- * Moves a rectangle to the new location by moving its upper left corner
- * to the point with coordinates X and Y.
- *
- * @param x the new X coordinate of the rectangle's upper left corner.
- * @param y the new Y coordinate of the rectangle's upper left corner.
+ * Moves a rectangle to the new location by moving its upper left corner to
+ * the point with coordinates X and Y.
*
+ * @param x
+ * the new X coordinate of the rectangle's upper left corner.
+ * @param y
+ * the new Y coordinate of the rectangle's upper left corner.
* @deprecated Use setLocation(int, int) method.
*/
@Deprecated
@@ -260,16 +284,19 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Sets the rectangle to be the nearest rectangle with integer coordinates
+ * Sets the rectangle to be the nearest rectangle with integer coordinates
* bounding the rectangle defined by the double-valued parameters.
*
- * @param x the X coordinate of the upper left corner of the double-valued
- * rectangle to be bounded.
- * @param y the Y coordinate of the upper left corner of the double-valued
- * rectangle to be bounded.
- * @param width the width of the rectangle to be bounded.
- * @param height the height of the rectangle to be bounded.
- *
+ * @param x
+ * the X coordinate of the upper left corner of the double-valued
+ * rectangle to be bounded.
+ * @param y
+ * the Y coordinate of the upper left corner of the double-valued
+ * rectangle to be bounded.
+ * @param width
+ * the width of the rectangle to be bounded.
+ * @param height
+ * the height of the rectangle to be bounded.
* @see java.awt.geom.Rectangle2D#setRect(double, double, double, double)
*/
@Override
@@ -284,9 +311,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Sets a new size for the rectangle.
*
- * @param width the rectangle's new width.
- * @param height the rectangle's new height.
- *
+ * @param width
+ * the rectangle's new width.
+ * @param height
+ * the rectangle's new height.
* @deprecated use the setSize(int, int) method.
*/
@Deprecated
@@ -295,14 +323,17 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Resets the bounds of a rectangle to the specified x, y, width and height
+ * Resets the bounds of a rectangle to the specified x, y, width and height
* parameters.
*
- * @param x the new X coordinate of the upper left corner.
- * @param y the new Y coordinate of the upper left corner.
- * @param width the new width of rectangle.
- * @param height the new height of rectangle.
- *
+ * @param x
+ * the new X coordinate of the upper left corner.
+ * @param y
+ * the new Y coordinate of the upper left corner.
+ * @param width
+ * the new width of rectangle.
+ * @param height
+ * the new height of rectangle.
* @deprecated use setBounds(int, int, int, int) method
*/
@Deprecated
@@ -312,10 +343,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Gets bounds of the rectangle as a new Rectangle object.
- *
- * @return the Rectangle object with the same bounds as
- * the original rectangle.
*
+ * @return the Rectangle object with the same bounds as the original
+ * rectangle.
* @see java.awt.geom.RectangularShape#getBounds()
*/
@Override
@@ -325,10 +355,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Gets the bounds of the original rectangle as a Rectangle2D object.
- *
- * @return the Rectangle2D object which represents the bounds of
- * the original rectangle.
*
+ * @return the Rectangle2D object which represents the bounds of the
+ * original rectangle.
* @see java.awt.geom.Rectangle2D#getBounds2D()
*/
@Override
@@ -337,13 +366,17 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Sets the bounds of a rectangle to the specified x, y, width, and height
+ * Sets the bounds of a rectangle to the specified x, y, width, and height
* parameters.
*
- * @param x the X coordinate of the upper left corner.
- * @param y the Y coordinate of the upper left corner.
- * @param width the width of rectangle.
- * @param height the height of rectangle.
+ * @param x
+ * the X coordinate of the upper left corner.
+ * @param y
+ * the Y coordinate of the upper left corner.
+ * @param width
+ * the width of rectangle.
+ * @param height
+ * the height of rectangle.
*/
public void setBounds(int x, int y, int width, int height) {
this.x = x;
@@ -353,25 +386,26 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Sets the bounds of the rectangle to match the bounds of the
- * Rectangle object sent as a parameter.
+ * Sets the bounds of the rectangle to match the bounds of the Rectangle
+ * object sent as a parameter.
*
- * @param r the Rectangle object which specifies the new bounds.
+ * @param r
+ * the Rectangle object which specifies the new bounds.
*/
public void setBounds(Rectangle r) {
setBounds(r.x, r.y, r.width, r.height);
}
/**
- * Enlarges the rectangle by moving each corner outward from the
- * center by a distance of dx horizonally and a distance of dy
- * vertically. Specifically, changes a rectangle with
- * [x, y, width, height] parameters to
- * a rectangle with [x-dx, y-dy, width+2*dx, height+2*dy]
- * parameters.
- *
- * @param dx the horizontal distance to move each corner coordinate.
- * @param dy the vertical distance to move each corner coordinate.
+ * Enlarges the rectangle by moving each corner outward from the center by a
+ * distance of dx horizonally and a distance of dy vertically. Specifically,
+ * changes a rectangle with [x, y, width, height] parameters to a rectangle
+ * with [x-dx, y-dy, width+2*dx, height+2*dy] parameters.
+ *
+ * @param dx
+ * the horizontal distance to move each corner coordinate.
+ * @param dy
+ * the vertical distance to move each corner coordinate.
*/
public void grow(int dx, int dy) {
x -= dx;
@@ -381,11 +415,13 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Moves a rectangle a distance of mx along the x coordinate axis
- * and a distance of my along y coordinate axis.
+ * Moves a rectangle a distance of mx along the x coordinate axis and a
+ * distance of my along y coordinate axis.
*
- * @param mx the horizontal translation increment.
- * @param my the vertical translation increment.
+ * @param mx
+ * the horizontal translation increment.
+ * @param my
+ * the vertical translation increment.
*/
public void translate(int mx, int my) {
x += mx;
@@ -395,8 +431,12 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Enlarges the rectangle to cover the specified point.
*
- * @param px the X coordinate of the new point to be covered by the rectangle.
- * @param py the Y coordinate of the new point to be covered by the rectangle.
+ * @param px
+ * the X coordinate of the new point to be covered by the
+ * rectangle.
+ * @param py
+ * the Y coordinate of the new point to be covered by the
+ * rectangle.
*/
public void add(int px, int py) {
int x1 = Math.min(x, px);
@@ -407,11 +447,12 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Enlarges the rectangle to cover the specified point with the
- * new point given as a Point object.
+ * Enlarges the rectangle to cover the specified point with the new point
+ * given as a Point object.
*
- * @param p the Point object that specifies the new point to
- * be covered by the rectangle.
+ * @param p
+ * the Point object that specifies the new point to be covered by
+ * the rectangle.
*/
public void add(Point p) {
add(p.x, p.y);
@@ -421,7 +462,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
* Adds a new rectangle to the original rectangle, the result is an union of
* the specified specified rectangle and original rectangle.
*
- * @param r the Rectangle which is added to the original rectangle.
+ * @param r
+ * the Rectangle which is added to the original rectangle.
*/
public void add(Rectangle r) {
int x1 = Math.min(x, r.x);
@@ -432,14 +474,15 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Determines whether or not the point with specified coordinates [px, py]
+ * Determines whether or not the point with specified coordinates [px, py]
* is within the bounds of the rectangle.
*
- * @param px the X coordinate of point.
- * @param py the Y coordinate of point.
- *
- * @return true, if the point with specified coordinates [px, py] is
- * within the bounds of the rectangle, otherwise false.
+ * @param px
+ * the X coordinate of point.
+ * @param py
+ * the Y coordinate of point.
+ * @return true, if the point with specified coordinates [px, py] is within
+ * the bounds of the rectangle, false otherwise.
*/
public boolean contains(int px, int py) {
if (isEmpty()) {
@@ -454,29 +497,32 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Determines whether or not the point given as a Point object
- * is within the bounds of the rectangle.
- *
- * @param p the Point object
+ * Determines whether or not the point given as a Point object is within the
+ * bounds of the rectangle.
*
- * @return true, if the point p is within the bounds of the
- * rectangle, otherwise false.
+ * @param p
+ * the Point object
+ * @return true, if the point p is within the bounds of the rectangle,
+ * otherwise false.
*/
public boolean contains(Point p) {
return contains(p.x, p.y);
}
/**
- * Determines whether or not the rectangle specified by [rx, ry, rw, rh]
+ * Determines whether or not the rectangle specified by [rx, ry, rw, rh]
* parameters is located inside the original rectangle.
*
- * @param rx the X coordinate of the rectangle to compare.
- * @param ry the Y coordinate of the rectangle to compare.
- * @param rw the width of the rectangle to compare.
- * @param rh the height of the rectangle to compare.
- *
+ * @param rx
+ * the X coordinate of the rectangle to compare.
+ * @param ry
+ * the Y coordinate of the rectangle to compare.
+ * @param rw
+ * the width of the rectangle to compare.
+ * @param rh
+ * the height of the rectangle to compare.
* @return true, if a rectangle with [rx, ry, rw, rh] parameters is entirely
- * contained in the original rectangle, otherwise false.
+ * contained in the original rectangle, false otherwise.
*/
public boolean contains(int rx, int ry, int rw, int rh) {
return contains(rx, ry) && contains(rx + rw - 1, ry + rh - 1);
@@ -486,25 +532,25 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
* Compares whether or not the rectangle specified by the Rectangle object
* is located inside the original rectangle.
*
- * @param r the Rectangle object.
- *
+ * @param r
+ * the Rectangle object.
* @return true, if the rectangle specified by Rectangle object is entirely
- * contained in the original rectangle, otherwise false.
+ * contained in the original rectangle, false otherwise.
*/
public boolean contains(Rectangle r) {
return contains(r.x, r.y, r.width, r.height);
}
/**
- * Compares whether or not a point with specified coordinates [px, py] belongs
- * to a rectangle.
- *
- * @param px the X coordinate of a point.
- * @param py the Y coordinate of a point.
- *
- * @return true, if a point with specified coordinates [px, py] belongs
- * to a rectangle, otherwise false.
+ * Compares whether or not a point with specified coordinates [px, py]
+ * belongs to a rectangle.
*
+ * @param px
+ * the X coordinate of a point.
+ * @param py
+ * the Y coordinate of a point.
+ * @return true, if a point with specified coordinates [px, py] belongs to a
+ * rectangle, otherwise false.
* @deprecated use contains(int, int) method.
*/
@Deprecated
@@ -513,20 +559,19 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Returns the intersection of the original rectangle with the
- * specified Rectangle2D.
- *
- * @param r the Rectangle2D object.
- *
- * @return the Rectangle2D object that is the result of intersecting
- * the original rectangle with the specified Rectangle2D.
+ * Returns the intersection of the original rectangle with the specified
+ * Rectangle2D.
*
+ * @param r
+ * the Rectangle2D object.
+ * @return the Rectangle2D object that is the result of intersecting the
+ * original rectangle with the specified Rectangle2D.
* @see java.awt.geom.Rectangle2D#createIntersection(java.awt.geom.Rectangle2D)
*/
@Override
public Rectangle2D createIntersection(Rectangle2D r) {
if (r instanceof Rectangle) {
- return intersection((Rectangle) r);
+ return intersection((Rectangle)r);
}
Rectangle2D dst = new Rectangle2D.Double();
Rectangle2D.intersect(this, r, dst);
@@ -534,14 +579,13 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Returns the intersection of the original rectangle with the
- * specified rectangle. An empty rectangle is returned if there is no
- * intersection.
- *
- * @param r the Rectangle object.
+ * Returns the intersection of the original rectangle with the specified
+ * rectangle. An empty rectangle is returned if there is no intersection.
*
- * @return the Rectangle object is result of the original rectangle with the
- * specified rectangle.
+ * @param r
+ * the Rectangle object.
+ * @return the Rectangle object is result of the original rectangle with the
+ * specified rectangle.
*/
public Rectangle intersection(Rectangle r) {
int x1 = Math.max(x, r.x);
@@ -552,39 +596,38 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Determines whether or not the original rectangle intersects
- * the specified rectangle.
+ * Determines whether or not the original rectangle intersects the specified
+ * rectangle.
*
- * @param r the Rectangle object.
- *
- * @return true, if the two rectangles overlap; otherwise false.
+ * @param r
+ * the Rectangle object.
+ * @return true, if the two rectangles overlap, false otherwise.
*/
public boolean intersects(Rectangle r) {
return !intersection(r).isEmpty();
}
/**
- * Determines where the specified Point is located with respect to
- * the rectangle. This method computes whether the point is to the
- * right or to the left of the rectangle and whether it is above
- * or below the rectangle, and packs the result into an int by
- * using a binary OR operation with the following masks:
+ * Determines where the specified Point is located with respect to the
+ * rectangle. This method computes whether the point is to the right or to
+ * the left of the rectangle and whether it is above or below the rectangle,
+ * and packs the result into an integer by using a binary OR operation with
+ * the following masks:
*
*
Rectangle2D.OUT_LEFT
*
Rectangle2D.OUT_TOP
*
Rectangle2D.OUT_RIGHT
*
Rectangle2D.OUT_BOTTOM
*
- *
- * If the rectangle is empty, all masks are set, and if the
- * point is inside the rectangle, none are set.
- *
- * @param px the X coordinate of the specified point.
- * @param py the Y coordinate of the specified point.
- *
- * @return the location of the Point relative to the rectangle
- * as the result of logical OR operation with all out masks.
- *
+ * If the rectangle is empty, all masks are set, and if the point is inside
+ * the rectangle, none are set.
+ *
+ * @param px
+ * the X coordinate of the specified point.
+ * @param py
+ * the Y coordinate of the specified point.
+ * @return the location of the Point relative to the rectangle as the result
+ * of logical OR operation with all out masks.
* @see java.awt.geom.Rectangle2D#outcode(double, double)
*/
@Override
@@ -593,23 +636,19 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
if (width <= 0) {
code |= OUT_LEFT | OUT_RIGHT;
- } else
- if (px < x) {
- code |= OUT_LEFT;
- } else
- if (px > x + width) {
- code |= OUT_RIGHT;
- }
+ } else if (px < x) {
+ code |= OUT_LEFT;
+ } else if (px > x + width) {
+ code |= OUT_RIGHT;
+ }
if (height <= 0) {
code |= OUT_TOP | OUT_BOTTOM;
- } else
- if (py < y) {
- code |= OUT_TOP;
- } else
- if (py > y + height) {
- code |= OUT_BOTTOM;
- }
+ } else if (py < y) {
+ code |= OUT_TOP;
+ } else if (py > y + height) {
+ code |= OUT_BOTTOM;
+ }
return code;
}
@@ -617,10 +656,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Enlarges the rectangle to cover the specified Rectangle2D.
*
- * @param r the Rectangle2D object.
- *
+ * @param r
+ * the Rectangle2D object.
* @return the union of the original and the specified Rectangle2D.
- *
* @see java.awt.geom.Rectangle2D#createUnion(java.awt.geom.Rectangle2D)
*/
@Override
@@ -636,8 +674,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Enlarges the rectangle to cover the specified rectangle.
*
- * @param r the Rectangle.
- *
+ * @param r
+ * the Rectangle.
* @return the union of the original and the specified rectangle.
*/
public Rectangle union(Rectangle r) {
@@ -649,11 +687,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
/**
* Compares the original Rectangle with the specified object.
*
- * @param obj the specified Object for comparison.
- *
- * @return true, if the specified Object is a rectangle with the
- * same dimensions as the original rectangle, otherwise false.
- *
+ * @param obj
+ * the specified Object for comparison.
+ * @return true, if the specified Object is a rectangle with the same
+ * dimensions as the original rectangle, false otherwise.
* @see java.awt.geom.Rectangle2D#equals(Object)
*/
@Override
@@ -669,18 +706,18 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable {
}
/**
- * Returns a string representation of the rectangle; the string contains
- * [x, y, width, height] parameters of the rectangle.
+ * Returns a string representation of the rectangle; the string contains [x,
+ * y, width, height] parameters of the rectangle.
*
* @return the string representation of the rectangle.
*/
@Override
public String toString() {
- // The output format based on 1.5 release behaviour. It could be obtained in the following way
+ // The output format based on 1.5 release behaviour. It could be
+ // obtained in the following way
// System.out.println(new Rectangle().toString())
return getClass().getName() + "[x=" + x + ",y=" + y + //$NON-NLS-1$ //$NON-NLS-2$
- ",width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ",width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
-
diff --git a/awt/java/awt/RenderingHints.java b/awt/java/awt/RenderingHints.java
index 495788490ac36191cb63949560c940b4f0ed889c..acf6fa15de07d112850dcbfa33cf6fa6227500f3 100644
--- a/awt/java/awt/RenderingHints.java
+++ b/awt/java/awt/RenderingHints.java
@@ -18,6 +18,7 @@
* @author Alexey A. Petrenko
* @version $Revision$
*/
+
package java.awt;
import java.util.Collection;
@@ -27,224 +28,219 @@ import java.util.Map;
import java.util.Set;
/**
- * The RenderingHints class represents preferences for the rendering algorithms.
- * The preferences are arbitrary and can be specified by Map objects or by
- * key-value pairs.
+ * The RenderingHints class represents preferences for the rendering algorithms.
+ * The preferences are arbitrary and can be specified by Map objects or by
+ * key-value pairs.
+ *
+ * @since Android 1.0
*/
public class RenderingHints implements Map