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

Popup menu allows to change non-editable text components.

XMLWordPrintable

    • x86
    • windows_nt



      Name: asR10013 Date: 02/01/2001



      Bug description ---> Windows' popup menu for text area fields allows to change
      content of the field even if setEditable is false.
      ****************************************************************************
      Failing Test:
      =============


      JCK :
      =====

      Test source location:
      ====================

      Platforms:
      =============
      Windows NT 4.0
      Windows ME
      Windows 95


      JDK, switches Info:
      ===================
      java version "1.3.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-beta-b15)
      Java HotSpot(TM) Client VM (build 1.3.1beta-b15, mixed mode)

      jtr file location:
      ==================

      How to reproduce:
      ====================
      The following test example creates a frame window that contains text
      area component and a button.

      To reproduce bug do the following steps:
      1. Change text in the text area.
      2. Press button below to make textarea non-editable
      3. Right-Click in the text area and choose Undo in the popup menu.

      You will see the text is changed.

      Source
      ======
      //---------------------------- test.java --------------------------------------------
      import java.awt.*;
      import java.awt.event.*;

      public class test extends Frame implements ActionListener{
          static TextComponent aText;
          static Button aBtn;
          public static void main( String[] args ) throws Exception {
              test f = new test();
      f.setSize(300, 300);

      f.setLayout( new GridLayout(2,2) );
      aText = new TextArea("Please, type any new text here,\npress a button below,\nthen right-click in this field\nand select \"Undo\"");
      f.add( aText );
      aBtn = new Button( "setEditable(false)" );
      f.add( aBtn );
      aBtn.addActionListener( f );
      aText.setVisible( true );
      aBtn.setVisible( true );

      f.setVisible( true );
      System.in.read();
      f.dispose();
      System.exit(0);
          };
          public void actionPerformed(ActionEvent e) {
              if( e.getSource() instanceof Button ) {
      boolean b = aText.isEditable();
      aText.setEditable( !b );
      aBtn.setLabel( "setEditable(" + b + ")" );
      };
          };
      };

      //---------------------------- end test.java --------------------------------------------

      Test output:
      =============

      Specific Machine Info:
      =====================
      hostname: linux-11

      Additional JCK related info:
      ============================
      URL to find JCK test owners: http://javaweb.eng/jck/usr/owners.jto


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

            bchristi Brent Christian
            alssunw Als Als (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: