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

TextField in Dialogs coming up black on Win32

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • generic, x86
    • solaris_2.5.1, windows_95



      Name: rm29839 Date: 02/03/98


      When creating a TextArea in 1.2 beta2 the
      background color defaults to black instead of
      white. *All* previous versions of Java (on all
      9 platforms our code runs on) default
      to a white background.

      Our latest report of this bug was deleted and
      marked as "user error". This is *NOT* a user
      error, this is an inconsistent change in Java.

      If this is then new default behaiour please
      insure it is documented in the JDK release notes!

      /*
      This simple extension of the java.awt.Frame class
      contains all the elements necessary to act as the
      main window of an application.
       */

      import java.awt.*;

      public class Frame1 extends Frame
      {
        public Frame1()
        {
          // This code is automatically generated by Visual Cafe when you add
          // components to the visual environment. It instantiates and initializes
          // the components. To modify the code, only use code syntax that matches
          // what Visual Cafe can generate, or Visual Cafe may be unable to back
          // parse your Java file into its visual environment.
          
          //{{INIT_CONTROLS
          setLayout(null);
          setVisible(false);
          setSize(insets().left + insets().right + 405,insets().top + insets().bottom + 305);
          setTitle("A Basic Application");
          //}}
          
          //{{INIT_MENUS
          mainMenuBar = new java.awt.MenuBar();
          menu1 = new java.awt.Menu("File");
          menu1.addSeparator();
          miExit = new java.awt.MenuItem("Exit");
          menu1.add(miExit);
          mainMenuBar.add(menu1);
          setMenuBar(mainMenuBar);
          //$$ mainMenuBar.move(4,277);
          //}}
          
          //{{REGISTER_LISTENERS
          SymWindow aSymWindow = new SymWindow();
          this.addWindowListener(aSymWindow);
          SymAction lSymAction = new SymAction();
          miExit.addActionListener(lSymAction);
          //}}
        }
        
        public Frame1(String title)
        {
          this();
          setTitle(title);
        }
        
        public synchronized void show()
        {
          move(150, 50);
          super.show();
        }
        
        static public void main(String args[])
        {
          (new Frame1()).show();
        }
        
        public void addNotify()
        {
          // Record the size of the window prior to calling parents addNotify.
          Dimension d = getSize();
          
          super.addNotify();
          
          if (fComponentsAdjusted)
            return;
          
          // Adjust components according to the insets
          setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.height);
          Component components[] = getComponents();
          for (int i = 0; i < components.length; i++)
            {
      Point p = components[i].getLocation();
      p.translate(insets().left, insets().top);
      components[i].setLocation(p);
            }
          fComponentsAdjusted = true;
        }
        
        // Used for addNotify check.
        boolean fComponentsAdjusted = false;
        
        //{{DECLARE_CONTROLS
        //}}
        
        //{{DECLARE_MENUS
        java.awt.MenuBar mainMenuBar;
        java.awt.Menu menu1;
        java.awt.MenuItem miExit;
        //}}
        
        class SymWindow extends java.awt.event.WindowAdapter
        {
          public void windowClosing(java.awt.event.WindowEvent event)
          {
            Object object = event.getSource();
            if (object == Frame1.this)
      Frame1_WindowClosing(event);
          }
        }
        
        void Frame1_WindowClosing(java.awt.event.WindowEvent event)
        {
          dispose(); // free the system resources
          System.exit(0); // close the application
        }
        
        class SymAction implements java.awt.event.ActionListener
        {
          public void actionPerformed(java.awt.event.ActionEvent event)
          {
            Object object = event.getSource();
            if (object == miExit)
      miExit_Action(event);
          }
        }
        
        void miExit_Action(java.awt.event.ActionEvent event)
        {
          //{{CONNECTION
          // Action from Exit Create and show as modal
          (new QuitDialog(this, true)).show();
          //}}
        }
        
      }

      /*
      A basic extension of the java.awt.Dialog class
       */

      import java.awt.*;
      import java.awt.event.*;

      public class QuitDialog extends Dialog
      {
        public QuitDialog(Frame parent, boolean modal)
        {
          super(parent, modal);
          
          // This code is automatically generated by Visual Cafe when you add
          // components to the visual environment. It instantiates and initializes
          // the components. To modify the code, only use code syntax that matches
          // what Visual Cafe can generate, or Visual Cafe may be unable to back
          // parse your Java file into its visual environment.
          //{{INIT_CONTROLS
          setLayout(null);
          setVisible(false);
          setSize(insets().left + insets().right + 337,insets().top + insets().bottom + 135);
          yesButton = new java.awt.Button();
          yesButton.setLabel(" Yes ");
          yesButton.setBounds(insets().left + 72,insets().top + 80,79,22);
          yesButton.setFont(new Font("Dialog", Font.BOLD, 12));
          add(yesButton);
          noButton = new java.awt.Button();
          noButton.setLabel(" No ");
          noButton.setBounds(insets().left + 185,insets().top + 80,79,22);
          noButton.setFont(new Font("Dialog", Font.BOLD, 12));
          add(noButton);
          textField1 = new java.awt.TextField();
          textField1.setText("Do you really want to quit?");
          textField1.setBounds(insets().left + 84,insets().top + 24,168,40);
          add(textField1);
          setTitle("A Basic Application - Quit");
          //}}
          
          //{{REGISTER_LISTENERS
          SymWindow aSymWindow = new SymWindow();
          this.addWindowListener(aSymWindow);
          SymAction lSymAction = new SymAction();
          noButton.addActionListener(lSymAction);
          yesButton.addActionListener(lSymAction);
          //}}
        }
        
        public void addNotify()
        {
          // Record the size of the window prior to calling parents addNotify.
          Dimension d = getSize();
          
          super.addNotify();
          
          if (fComponentsAdjusted)
            return;
          
          // Adjust components according to the insets
          setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.height);
          Component components[] = getComponents();
          for (int i = 0; i < components.length; i++)
            {
      Point p = components[i].getLocation();
      p.translate(insets().left, insets().top);
      components[i].setLocation(p);
            }
          fComponentsAdjusted = true;
        }
        
        public QuitDialog(Frame parent, String title, boolean modal)
        {
          this(parent, modal);
          setTitle(title);
        }
        
        public synchronized void show()
        {
          Rectangle bounds = getParent().bounds();
          Rectangle abounds = bounds();
          
          move(bounds.x + (bounds.width - abounds.width)/ 2,
      bounds.y + (bounds.height - abounds.height)/2);
          
          super.show();
        }
        
        // Used for addNotify check.
        boolean fComponentsAdjusted = false;
        
        //{{DECLARE_CONTROLS
        java.awt.Button yesButton;
        java.awt.Button noButton;
        java.awt.TextField textField1;
        //}}
        
        class SymWindow extends java.awt.event.WindowAdapter
        {
          public void windowClosing(java.awt.event.WindowEvent event)
          {
            Object object = event.getSource();
            if (object == QuitDialog.this)
      QuitDialog_WindowClosing(event);
          }
        }
        
        void QuitDialog_WindowClosing(java.awt.event.WindowEvent event)
        {
          dispose();
        }
        
        class SymAction implements java.awt.event.ActionListener
        {
          public void actionPerformed(java.awt.event.ActionEvent event)
          {
            Object object = event.getSource();
            if (object == noButton)
      noButton_Clicked(event);
            else if (object == yesButton)
      yesButton_Clicked(event);
          }
        }
        
        void yesButton_Clicked(java.awt.event.ActionEvent event)
        {
          Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((java.awt.Window)getParent(), WindowEvent.WINDOW_CLOSING));
        }
        
        void noButton_Clicked(java.awt.event.ActionEvent event)
        {
          dispose();
        }
        
      }

      (Review ID: 24291)
      ======================================================================

            Unassigned Unassigned
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: