Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4284962

ctor JRadioButtonMenuItem(Action a) ignores toolTipText

XMLWordPrintable



      Name: sdC67446 Date: 10/26/99


      The method
          public JRadioButtonMenuItem(Action a)
      of class
          javax.swing.JRadioButtonMenuItem
      doesn't take the toolTipText property from the 'a'.

      The doc says:
      --------------------------------------------------
      public JRadioButtonMenuItem(Action a)

            Creates a radiobutton menu item whose properties are taken from
            the Action supplied.
            Since:
                  1.3
      the demo test:
      --------------------------------------------------
      import javax.swing.*;
      import java.awt.event.*;
      import java.beans.PropertyChangeListener;

      public class Test {

          public static class FakeAction implements Action {
              
              private String name;
              private Icon icon;
              private String short_description;
              private boolean isEnabled;
              
              public FakeAction(String name,
                                Icon icon,
                                String short_description,
                                boolean isEnabled) {
                  this.name = name;
                  this.icon = icon;
                  this.short_description = short_description;
                  this.isEnabled = isEnabled;
              }
              
              public Object getValue(String key) {
                  if (key.equals(Action.NAME)) {
                      return name;
                  } else if (key.equals(Action.SMALL_ICON)) {
                      return icon;
                  } else if (key.equals(Action.SHORT_DESCRIPTION)) {
                      return short_description;
                  } else {
                      return null;
                  }
              }
              public void putValue(String key, Object value) {}
              public void setEnabled(boolean b) {isEnabled = b;}
              public boolean isEnabled() {return isEnabled;}
              public void addPropertyChangeListener(PropertyChangeListener listener) {}
              public void removePropertyChangeListener(PropertyChangeListener listener) {}
              public void actionPerformed(ActionEvent e) {}
          }

          public static void main(String argv[]) {
              String name = "name";
              Icon icon = new ImageIcon();
              String short_description = "short_description";
              boolean isEnabled = true;

              FakeAction action =
                  new FakeAction(name, icon, short_description, isEnabled);
              JRadioButtonMenuItem rb = new JRadioButtonMenuItem(action);
              System.out.println("getText(): "+rb.getText()+", "+name);
              System.out.println("getIcon(): "+rb.getIcon()+", "+icon);
              System.out.println("getToolTipText(): "+rb.getToolTipText()+", "+short_description);
              System.out.println("isEnabled(): "+rb.isEnabled()+", "+isEnabled);
          }
      }

      output:
      --------------------------------------------------
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      getText(): name, name
      getIcon(): javax.swing.ImageIcon@21b6d, javax.swing.ImageIcon@21b6d
      getToolTipText(): null, short_description
      isEnabled(): true, true
      --------------------------------------------------
      ======================================================================

            leifs Leif Samuelsson (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: