[gui][PATCH] JRadioButtonMenuItem / JCheckBoxMenuItem: javadocs & few fixes
Olga Rodimina
rodimina@redhat.com
Mon Jun 21 15:16:00 GMT 2004
Hi,
This patch adds javadocs and makes few small fixes to files implementing
JRadioButtonMenuItem & JCheckBoxMenuItem.
I'll be committing this patch to java-gui-branch.
Olga.
-------------- next part --------------
? .snprj
? libjava.proj
? patch
? popup_Patch
? resources
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2660.2.210
diff -c -p -u -r1.2660.2.210 ChangeLog
--- ChangeLog 20 Jun 2004 15:27:41 -0000 1.2660.2.210
+++ ChangeLog 21 Jun 2004 15:02:20 -0000
@@ -1,3 +1,14 @@
+2004-06-21 Olga Rodimina <rodimina@redhat.com>
+
+ * javax/swing/JCheckBoxMenuItem.java: Added Javadoc.
+ (getSelectedObjects): Implemented.
+ * javax/swing/JRadioButtonMenuItem.java: Added Javadoc.
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java:
+ Added javadoc for few methods.
+ (processMouseEvent): Made public.
+ * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+ (processMouseEvent): Likewise.
+
2004-06-20 Michael Koch <konqueror@gmx.de>
* javax/swing/text/AbstractDocument.java
Index: javax/swing/JCheckBoxMenuItem.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JCheckBoxMenuItem.java,v
retrieving revision 1.3.8.6
diff -c -p -u -r1.3.8.6 JCheckBoxMenuItem.java
--- javax/swing/JCheckBoxMenuItem.java 8 Jun 2004 09:28:42 -0000 1.3.8.6
+++ javax/swing/JCheckBoxMenuItem.java 21 Jun 2004 15:02:21 -0000
@@ -45,16 +45,24 @@ import javax.accessibility.AccessibleRol
/**
- * DOCUMENT ME!
+ * JCheckBoxMenuItem
*/
public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
Accessible
{
private static final long serialVersionUID = -6676402307973384715L;
+ /** name for the UI delegate for this menuItem. */
private static final String uiClassID = "CheckBoxMenuItemUI";
+
+ /** Indicates whether this menu item is checked. */
private boolean state;
- private Object[] selectedObjects;
+
+ /**
+ * This array contains text of this menu item if this menu item is in
+ * checked state and null it is not.
+ */
+ private Object[] selectedObjects = new Object[1];
/**
* Creates a new JCheckBoxMenuItem object.
@@ -65,9 +73,9 @@ public class JCheckBoxMenuItem extends J
}
/**
- * Creates a new JCheckBoxMenuItem object.
+ * Creates a new JCheckBoxMenuItem with given icon
*
- * @param icon DOCUMENT ME!
+ * @param icon Icon for this menu item
*/
public JCheckBoxMenuItem(Icon icon)
{
@@ -75,9 +83,9 @@ public class JCheckBoxMenuItem extends J
}
/**
- * Creates a new JCheckBoxMenuItem object.
+ * Creates a new JCheckBoxMenuItem with given label
*
- * @param text DOCUMENT ME!
+ * @param text Label for this menu item
*/
public JCheckBoxMenuItem(String text)
{
@@ -85,9 +93,9 @@ public class JCheckBoxMenuItem extends J
}
/**
- * Creates a new JCheckBoxMenuItem object.
+ * Creates a new JCheckBoxMenuItem using given action
*
- * @param action DOCUMENT ME!
+ * @param action Action for this menu item.
*/
public JCheckBoxMenuItem(Action action)
{
@@ -96,10 +104,10 @@ public class JCheckBoxMenuItem extends J
}
/**
- * Creates a new JCheckBoxMenuItem object.
+ * Creates a new JCheckBoxMenuItem object with given label and icon
*
- * @param text DOCUMENT ME!
- * @param icon DOCUMENT ME!
+ * @param text Label for this menu item
+ * @param icon Icon for this menu item
*/
public JCheckBoxMenuItem(String text, Icon icon)
{
@@ -107,10 +115,11 @@ public class JCheckBoxMenuItem extends J
}
/**
- * Creates a new JCheckBoxMenuItem object.
+ * Creates a new JCheckBoxMenuItem object using specified label and
+ * marked as checked if given 'state' is true
*
- * @param text DOCUMENT ME!
- * @param state DOCUMENT ME!
+ * @param text Label for this menu item
+ * @param state True if this item should be in checked state and false otherwise
*/
public JCheckBoxMenuItem(String text, boolean state)
{
@@ -118,11 +127,12 @@ public class JCheckBoxMenuItem extends J
}
/**
- * Creates a new JCheckBoxMenuItem object.
+ * Creates a new JCheckBoxMenuItem object with given label, icon,
+ * and marked as checked if given 'state' is true
*
- * @param text DOCUMENT ME!
- * @param icon DOCUMENT ME!
- * @param state DOCUMENT ME!
+ * @param text Label for this menu item
+ * @param icon icon for this menu item
+ * @param state True if this item should be in checked state and false otherwise
*/
public JCheckBoxMenuItem(String text, Icon icon, boolean state)
{
@@ -131,22 +141,15 @@ public class JCheckBoxMenuItem extends J
this.state = state;
}
- /**
- * DOCUMENT ME!
- *
- * @param stream DOCUMENT ME!
- *
- * @throws IOException DOCUMENT ME!
- */
private void writeObject(ObjectOutputStream stream) throws IOException
{
- // TODO
}
/**
- * DOCUMENT ME!
+ * This method returns a name to identify which look and feel class will be
+ * the UI delegate for the menuItem.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return The Look and Feel classID. "JCheckBoxMenuItemUI"
*/
public String getUIClassID()
{
@@ -154,9 +157,10 @@ public class JCheckBoxMenuItem extends J
}
/**
- * DOCUMENT ME!
+ * Returns checked state for this check box menu item.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return Returns true if this menu item is in checked state
+ * and false otherwise.
*/
public boolean getState()
{
@@ -164,9 +168,12 @@ public class JCheckBoxMenuItem extends J
}
/**
- * DOCUMENT ME!
+ * Sets state for this check box menu item. If
+ * given 'state' is true, then mark menu item as checked,
+ * and uncheck this menu item otherwise.
+ *
+ * @param state new state for this menu item
*
- * @param state DOCUMENT ME!
*/
public synchronized void setState(boolean state)
{
@@ -174,38 +181,43 @@ public class JCheckBoxMenuItem extends J
}
/**
- * DOCUMENT ME!
+ * This method returns array containing label of this
+ * menu item if it is selected and null otherwise.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return Array containing label of this
+ * menu item if this menu item is selected or null otherwise.
*/
public Object[] getSelectedObjects()
{
+ if (state == true)
+ selectedObjects[0] = this.getText();
+ else
+ selectedObjects[0] = null;
+
return selectedObjects;
}
/**
- * DOCUMENT ME!
- */
+ * This method overrides JComponent.requestFocus with an empty
+ * implementation, since JCheckBoxMenuItems should not
+ * receve focus in general.
+ */
public void requestFocus()
{
- // TODO
+ // Should do nothing here
}
/**
- * DOCUMENT ME!
+ * A string that describes this JCheckBoxMenuItem. Normally only used
+ * for debugging.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return A string describing this JCheckBoxMenuItem
*/
protected String paramString()
{
return "JCheckBoxMenuItem";
}
- /**
- * DOCUMENT ME!
- *
- * @return $returnType$ DOCUMENT ME!
- */
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
@@ -214,9 +226,6 @@ public class JCheckBoxMenuItem extends J
return accessibleContext;
}
- /**
- * DOCUMENT ME!
- */
protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem
{
private static final long serialVersionUID = 1079958073579370777L;
@@ -228,11 +237,6 @@ public class JCheckBoxMenuItem extends J
{
}
- /**
- * DOCUMENT ME!
- *
- * @return $returnType$ DOCUMENT ME!
- */
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.CHECK_BOX;
Index: javax/swing/JRadioButtonMenuItem.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JRadioButtonMenuItem.java,v
retrieving revision 1.3.8.7
diff -c -p -u -r1.3.8.7 JRadioButtonMenuItem.java
--- javax/swing/JRadioButtonMenuItem.java 8 Jun 2004 09:28:42 -0000 1.3.8.7
+++ javax/swing/JRadioButtonMenuItem.java 21 Jun 2004 15:02:21 -0000
@@ -42,15 +42,18 @@ import java.io.ObjectOutputStream;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
/**
- * DOCUMENT ME!
+ * JRadioButtonMenuItem.
*/
public class JRadioButtonMenuItem extends JMenuItem implements Accessible
{
private static final long serialVersionUID = 8482658191548521743L;
+ /** name for the UI delegate for this radio button menu item. */
private static final String uiClassID = "RadioButtonMenuItemUI";
/**
@@ -62,9 +65,9 @@ public class JRadioButtonMenuItem extend
}
/**
- * Creates a new JRadioButtonMenuItem object.
+ * Creates a new JRadioButtonMenuItem with specified icon
*
- * @param icon DOCUMENT ME!
+ * @param icon Icon to be used for this menu item
*/
public JRadioButtonMenuItem(Icon icon)
{
@@ -72,9 +75,9 @@ public class JRadioButtonMenuItem extend
}
/**
- * Creates a new JRadioButtonMenuItem object.
+ * Creates a new JRadioButtonMenuItem with specified label
*
- * @param text DOCUMENT ME!
+ * @param text Label for this menu item
*/
public JRadioButtonMenuItem(String text)
{
@@ -82,9 +85,9 @@ public class JRadioButtonMenuItem extend
}
/**
- * Creates a new JRadioButtonMenuItem object.
+ * Creates a new JRadioButtonMenuItem using specified action
*
- * @param action DOCUMENT ME!
+ * @param action Action for this menu item
*/
public JRadioButtonMenuItem(Action action)
{
@@ -93,10 +96,10 @@ public class JRadioButtonMenuItem extend
}
/**
- * Creates a new JRadioButtonMenuItem object.
+ * Creates a new JRadioButtonMenuItem with specified label and icon
*
- * @param text DOCUMENT ME!
- * @param icon DOCUMENT ME!
+ * @param text Label for this menu item
+ * @param icon Icon for this menu item
*/
public JRadioButtonMenuItem(String text, Icon icon)
{
@@ -104,10 +107,11 @@ public class JRadioButtonMenuItem extend
}
/**
- * Creates a new JRadioButtonMenuItem object.
+ * Creates a new JRadioButtonMenuItem with specified label
+ * and marked selected if 'selected' is true.
*
- * @param text DOCUMENT ME!
- * @param selected DOCUMENT ME!
+ * @param text Text for this menu item
+ * @param selected Selected state of this menu item
*/
public JRadioButtonMenuItem(String text, boolean selected)
{
@@ -115,10 +119,11 @@ public class JRadioButtonMenuItem extend
}
/**
- * Creates a new JRadioButtonMenuItem object.
+ * Creates a new JRadioButtonMenuItem with specified icon
+ * and given selected state
*
- * @param icon DOCUMENT ME!
- * @param selected DOCUMENT ME!
+ * @param icon Icon for this menu item
+ * @param selected Selected state for this menu item
*/
public JRadioButtonMenuItem(Icon icon, boolean selected)
{
@@ -126,11 +131,12 @@ public class JRadioButtonMenuItem extend
}
/**
- * Creates a new JRadioButtonMenuItem object.
+ * Creates a new JRadioButtonMenuItem with specified label,
+ * icon and selected state.
*
- * @param text DOCUMENT ME!
- * @param icon DOCUMENT ME!
- * @param selected DOCUMENT ME!
+ * @param text Label for this menu item
+ * @param icon Icon to be use for this menu item
+ * @param selected selected state of this menu item
*/
public JRadioButtonMenuItem(String text, Icon icon, boolean selected)
{
@@ -139,22 +145,15 @@ public class JRadioButtonMenuItem extend
model.setSelected(selected);
}
- /**
- * DOCUMENT ME!
- *
- * @param stream DOCUMENT ME!
- *
- * @throws IOException DOCUMENT ME!
- */
private void writeObject(ObjectOutputStream stream) throws IOException
{
- // TODO
}
/**
- * DOCUMENT ME!
+ * This method returns a name to identify which look and feel class will be
+ * the UI delegate for the menuItem.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return The Look and Feel classID. "JRadioButtonMenuItemUI"
*/
public String getUIClassID()
{
@@ -162,28 +161,26 @@ public class JRadioButtonMenuItem extend
}
/**
- * DOCUMENT ME!
+ * This method overrides JComponent.requestFocus with an empty
+ * implementation, since JRadioButtonMenuItems should not
+ * receve focus in general.
*/
public void requestFocus()
{
- // TODO
+ // Should do nothing here
}
/**
- * DOCUMENT ME!
+ * A string that describes this JRadioButtonMenuItem. Normally only used
+ * for debugging.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return A string describing this JRadioButtonMenuItem
*/
protected String paramString()
{
return "JRadioButtonMenuItem";
}
- /**
- * DOCUMENT ME!
- *
- * @return $returnType$ DOCUMENT ME!
- */
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
@@ -192,9 +189,6 @@ public class JRadioButtonMenuItem extend
return accessibleContext;
}
- /**
- * DOCUMENT ME!
- */
protected class AccessibleJRadioButtonMenuItem extends AccessibleJMenuItem
{
private static final long serialVersionUID = 4381471510145292179L;
@@ -206,11 +200,6 @@ public class JRadioButtonMenuItem extend
{
}
- /**
- * DOCUMENT ME!
- *
- * @return $returnType$ DOCUMENT ME!
- */
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.RADIO_BUTTON;
Index: javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java,v
retrieving revision 1.1.2.4
diff -c -p -u -r1.1.2.4 BasicCheckBoxMenuItemUI.java
--- javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java 3 Jun 2004 14:21:51 -0000 1.1.2.4
+++ javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java 21 Jun 2004 15:02:22 -0000
@@ -53,11 +53,12 @@ import javax.swing.plaf.ComponentUI;
public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
{
/**
- * DOCUMENT ME!
+ * Factory method to create a BasicCheckBoxMenuItemUI for the given {@link
+ * JComponent}, which should be a JCheckBoxMenuItem
*
- * @param c DOCUMENT ME!
+ * @param c The {@link JComponent} a UI is being created for.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return A BasicCheckBoxMenuItemUI for the {@link JComponent}.
*/
public static ComponentUI createUI(final JComponent c)
{
@@ -71,11 +72,12 @@ public class BasicCheckBoxMenuItemUI ext
*/
protected String getPropertyPrefix()
{
- return null; // TODO
+ return null;
}
/**
- * DOCUMENT ME!
+ * This method installs the defaults that are defined in the Basic look and
+ * feel for this JRadioButtonMenuItem
*/
protected void installDefaults()
{
@@ -93,8 +95,9 @@ public class BasicCheckBoxMenuItemUI ext
* @param path DOCUMENT ME!
* @param manager DOCUMENT ME!
*/
- void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement[] path,
- MenuSelectionManager manager)
+ public void processMouseEvent(JMenuItem item, MouseEvent e,
+ MenuElement[] path,
+ MenuSelectionManager manager)
{
}
}
Index: javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java,v
retrieving revision 1.1.2.4
diff -c -p -u -r1.1.2.4 BasicRadioButtonMenuItemUI.java
--- javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java 9 Jun 2004 08:40:09 -0000 1.1.2.4
+++ javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java 21 Jun 2004 15:02:22 -0000
@@ -38,7 +38,6 @@ exception statement from your version. *
package javax.swing.plaf.basic;
import java.awt.event.MouseEvent;
-
import javax.swing.JComponent;
import javax.swing.JMenuItem;
import javax.swing.MenuElement;
@@ -49,7 +48,7 @@ import javax.swing.plaf.ComponentUI;
/**
- * DOCUMENT ME!
+ * UI Delegator for JRadioButtonMenuItem
*/
public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
{
@@ -64,12 +63,13 @@ public class BasicRadioButtonMenuItemUI
}
/**
- * DOCUMENT ME!
- *
- * @param b DOCUMENT ME!
- *
- * @return $returnType$ DOCUMENT ME!
- */
+ * Factory method to create a BasicRadioButtonMenuItemUI for the given {@link
+ * JComponent}, which should be a JRadioButtonMenuItem.
+ *
+ * @param b The {@link JComponent} a UI is being created for.
+ *
+ * @return A BasicRadioButtonMenuItemUI for the {@link JComponent}.
+ */
public static ComponentUI createUI(JComponent b)
{
return new BasicRadioButtonMenuItemUI();
@@ -83,7 +83,6 @@ public class BasicRadioButtonMenuItemUI
protected String getPropertyPrefix()
{
return null;
- // TODO
}
/**
@@ -94,8 +93,9 @@ public class BasicRadioButtonMenuItemUI
* @param path DOCUMENT ME!
* @param manager DOCUMENT ME!
*/
- void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement[] path,
- MenuSelectionManager manager)
+ public void processMouseEvent(JMenuItem item, MouseEvent e,
+ MenuElement[] path,
+ MenuSelectionManager manager)
{
}
}
More information about the Java-patches
mailing list