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

JButton.setAction(Action) set button text to null

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: pzC71691 Date: 07/21/99


      When Action with non-empty NAME property is set to an existing
      JButton with non-empty text via setAction(), JButton text becomes
      null. Also constructor of JButton witn Action argument doesn't
      initialize JButton text to Action.NAME property.

      The problem exists in the JDK1.3L build.

      The test case:

      -------------------------------------------------------------
      import javax.swing.*;
      import java.awt.event.*;


      public class ButtonBug extends JFrame {

        public void test() {
          getContentPane().setLayout(new FlowLayout());
          JButton bt1 = new JButton("Button1");
          getContentPane().add(bt1);
         
          AbstractAction al = new AbstractAction() {
              public void actionPerformed(ActionEvent e) {
             }
          };
          al.putValue(Action.NAME, "Action");

          bt1.setAction(al);
          JButton bt2 = new JButton(al);
          getContentPane().add(bt2);
          setBounds(20,20,200,200);
          setVisible(true);
        }
        
        public static void main(String[] argv) {
          ButtonBug b = new ButtonBug();
          b.test();
        }
      }

      ---------------------------------------------------------------------

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gsaab Georges Saab
              Reporter:
              peterz Peter Zhelezniakov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: