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

setEditable true/false gives different background color in Text Fields / Areas

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.7, 1.1.8
    • client-libs
    • x86
    • windows_95, windows_nt



      Name: tb29552 Date: 10/19/98


      //Begin color.java
      /*
      When you set Background color for a Text Field or
      Text Area using a color defined by its RGB values
      it shows right when the Text Field / Area is
      non-editable and it shows lighter if editable.

      DEMONSTRATION APPLET:
      tf1 & tf2 are 2 TextFields set to same background
      color. tf1 is made non-editable while tf2 is made
      editable. See the color difference when you run it.
      (same for tf3 and tf4. It does not seem to matter
      when you add the fields to the Applet.)
      */
      import java.applet.*;
      import java.awt.*;
      public class color extends Applet {

          TextField tf1 = new TextField(10);
          TextField tf2 = new TextField(10);
          TextField tf3 = new TextField(10);
          TextField tf4 = new TextField(10);
          Color color = new Color(51, 153, 255);

          public void init() {
              tf1.setBackground(color);
              tf2.setBackground(color);
              tf1.setEditable(false);
              tf2.setEditable(true);
              add(tf1);
              add(tf2);

              add(tf3);
              add(tf4);
              tf3.setEditable(false);
              tf4.setEditable(true);
              tf3.setBackground(color);
              tf4.setBackground(color);
          }
          public void paint(Graphics g) {
          }
      }
      //End color.java


      color.html:


      <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
      <html>
        <head>
          <title>Incident Detail #40586</title>
        </head>

        <body>
          <h1>Incident Detail #40586</h1>
          <hr>
          <applet code="color" width=600 height=666>
          </applet>
          <hr>

          <hr>
          <!-- Created: Wed Sep 30 13:42:02 PDT 1998 -->
          <!-- hhmts start -->
      Last modified: Mon Oct 19 14:25:59 PDT 1998
      <!-- hhmts end -->
        </body>
      </html>

      (Review ID: 40586)
      ======================================================================

            ehawkessunw Eric Hawkes (Inactive)
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: