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

Panel doesn't paint correctly in Java2 under eXceed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs
    • x86
    • solaris_2.6

      This is a Java2-only bug. I compiled and ran the following program (from "Java 1.2 and JavaScript for C and C++ Programmers") on SunOS 5.6.

      jdk 118 displayed just as the book said it would in Figure 3.6.... window containing a text string and an OK button.

      jdk122 displayed only the title bar of the window. When I manually resized the window, the text string "A serious Error" never appeared. I only saw the OK button.

      The bug still happens on jdk1.3beta.

      In both cases I was displaying to an NT box running eXceed 6.0 and eXceed 6.2.
      The machine running the java application was an Intel PPro 200mhz with 48mb ram and Solaris 2.6.


      //----------------------------Warning.java-------------------------------
      //package jwiley.chp3;

      import java.awt.Frame;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.Button;
      import java.awt.Graphics;
      import java.awt.Color;
      import java.awt.Panel;
      import java.awt.Point;

      /**
       * Simple class to demonstrate inheritance.
       */
      class Warning extends Frame implements ActionListener
      {
          /** Warning message. */
          private String message;

          /** constructor. */
          Warning(String title, String WarningMessage)
          {
              super(title);
              message = new String(WarningMessage);
              Panel p = new Panel();
              Button okButton = new Button("OK");
              okButton.addActionListener(this);
              p.add("Center", okButton);
              add("South",p);
              setSize(200,100);
              setLocation(new Point(50,50));
              setForeground(Color.black);
              setBackground(Color.white);
              setVisible(true);
          }

          /** event handler. */
          public void actionPerformed(ActionEvent evt)
          {
              if ("OK".equals(evt.getActionCommand()))
              {
                  System.exit(1);
              }
          }

          /** paint() method. */
          public void paint(Graphics g)
          {
              g.drawString(message,10,40);
          }

          /** main() method to invoke from JVM. */
          public static void main(String args[])
          {
              Warning anError = new Warning("Error", "A serious Error");
          }
      }

            son Oleg Sukhodolsky (Inactive)
            bklocksunw Brian Klock (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: