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

MAWT: Blank space at end of Choice list increases by each operation

XMLWordPrintable

    • x86, sparc
    • linux, solaris_2.5.1

      OPERATING SYSTEM(S):
      --------------------
      Red Hat Linux 4

      FULL JDK VERSION(S):
      -------------------
      java version "1.6.0_03"
      Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode)

      DESCRIPTION:
      ------------
      Height of Choice List becomes bigger and bigger by each operation.
      It happens only with MToolkit.

      RECREATION STEPS:
      -----------------
      1. Compile our testcase and launch it:
           $ javac Login.java
           $ AWT_TOOLKIT=MToolkit java Login
      2. Open "Font Style" choice component and close it
      3. Press down key to change the selection item of the Choice
      4. Keep press down key for a while
      5. Open Choice component

      Results:
      There is a big blank space at the end of list.

      Expected results:
      Choice's list is shown without any change.

      TESTCASE:
      ---------
      import java.awt.*;
      import java.awt.event.*;

      public class Login extends Frame {
          Frame f;
          Panel fontStylePanel;
          Label fontStyle;
          Choice chcUsers1;
          public Login ()
          {
              f=this;
              setLayout(new FlowLayout());
              chcUsers1 = new Choice ();
              chcUsers1.addItem("PLAIN");
              chcUsers1.addItem("BOLD");
              //add (chcUsers1);
              chcUsers1.addItem("ITALIC");
              chcUsers1.addItem("ITALICBOLD");
              FontPanelListener listener = new FontPanelListener();
              chcUsers1.addItemListener(listener);


              fontStylePanel = new Panel();
              fontStylePanel.add(fontStyle=new Label("Font Style:"));
              fontStylePanel.add(chcUsers1);

              f.add(fontStylePanel);
              pack ();

          }
          public static void main (String args[])
          {
              Login login = new Login ();
              login.show ();
          }

          class FontPanelListener implements ItemListener {


              public void itemStateChanged(ItemEvent event) {
                  String srcName = ((Component)event.getSource()).getName();
                  //setVisible(false);
                  int fontStyleval=Font.PLAIN;
                  String fontStyletype=chcUsers1.getSelectedItem();
                  if ("BOLD".equals(fontStyletype))
                      fontStyleval=Font.BOLD;
                  else if ("ITALIC".equals(fontStyletype))
                      fontStyleval=Font.ITALIC;

                  else if ("ITALICBOLD".equals(fontStyletype))
                      fontStyleval=(Font.ITALIC | Font.BOLD);
                  else
                      fontStyleval=Font.PLAIN;


                  Font font=new Font("Dialog", fontStyleval, 12);
                  fontStyle.setFont(font);
                  //setVisible(true);
                  f.pack();
              }

          }
      }

            Unassigned Unassigned
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: