This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui] [PATCH] FIx Menu's addSeparator() and insertSeparator()


Hello,

I committed the following patch to the java-gui-branch.  It fixes Menu's
addSeparator() and insertSeparator() methods.

-David Jee

2004-03-26  David Jee  <djee@redhat.com>

        * gnu/java/awt/peer/gtk/GtkMenuPeer.java
        (addSeparator): Remove.
        * java/awt/Menu.java
        (separator): Remove static final MenuItem field.
        (separatorLabel): New static final String field.
        (addSeparator): Do not use peer method; use add(MenuItem) instead.
        Use separatorLabel to denote that it is a separator.
        (insertSeparator): Create a new MenuItem with separatorLabel, instead
        of reusing the static separator instance, because a MenuItem instance
        can't be added more than once without being cloned.
        * java/awt/peer/MenuPeer.java
        (addSeparator): Remove from interface.


Index: gnu/java/awt/peer/gtk/GtkMenuPeer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java,v
retrieving revision 1.2
diff -u -r1.2 GtkMenuPeer.java
--- gnu/java/awt/peer/gtk/GtkMenuPeer.java	13 Jul 2003 15:09:20 -0000	1.2
+++ gnu/java/awt/peer/gtk/GtkMenuPeer.java	26 Mar 2004 19:03:53 -0000
@@ -95,10 +95,5 @@
     addItem (item, key, shiftModifier);
   }
 
-  public void addSeparator ()
-  {
-    addItem (new MenuItem ("-"));
-  }
-
   native public void delItem (int index);
 }
Index: java/awt/Menu.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Menu.java,v
retrieving revision 1.16
diff -u -r1.16 Menu.java
--- java/awt/Menu.java	3 Feb 2004 17:10:53 -0000	1.16
+++ java/awt/Menu.java	26 Mar 2004 19:03:54 -0000
@@ -82,7 +82,7 @@
 // From the serialization spec.  FIXME: what should it be?
 private int menuSerializedDataVersion;
 
-static final MenuItem separator = new MenuItem("-");
+static final String separatorLabel = "-";
 
 /*************************************************************************/
 
@@ -295,8 +295,7 @@
 public void
 addSeparator()
 {
-  if (peer != null)
-    ((MenuPeer) peer).addSeparator();
+  add(new MenuItem(separatorLabel));
 }
 
 /*************************************************************************/
@@ -314,7 +313,7 @@
 public void
 insertSeparator(int index)
 {
-  insert(separator, index);
+  insert(new MenuItem(separatorLabel), index);
 }
 
 /*************************************************************************/
Index: java/awt/peer/MenuPeer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/peer/MenuPeer.java,v
retrieving revision 1.6
diff -u -r1.6 MenuPeer.java
--- java/awt/peer/MenuPeer.java	11 Oct 2003 18:11:03 -0000	1.6
+++ java/awt/peer/MenuPeer.java	26 Mar 2004 19:03:54 -0000
@@ -43,7 +43,6 @@
 public interface MenuPeer extends MenuItemPeer
 {
   void addItem (MenuItem item);
-  void addSeparator ();
   void delItem (int index);
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]