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

REGRESSION: The contents of the dialog are offset vertically downwards

XMLWordPrintable


      ###@###.### 2002-05-17

      J2SE Version (please include all output from java -version flag):
        java version "1.4.1-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b10)
        Java HotSpot(TM) Client VM (build 1.4.1-beta-b10, mixed mode)

      Does this problem occur on J2SE 1.3 or 1.4? Yes / No (pick one)
        Only 1.4.1, works fine 1.4

      Operating System Configuration Information (be specific):
         Windows only, doesn't happen on Linux and tried Solaris

      Hardware Configuration Information (be specific):
         Windows 2000 on a Dell OptiPlex. Others here have repro'ed
         on various other PC hardware.

      Bug Description:
        Run the test program(TestDialog) and the problem is immediately
        apparent visually. The contents of the dialog are offset vertically
        downwards.

      Steps to Reproduce (be specific):
        run the app on a Windows machine

      Test program (TestDialog.java)
      -----------------
      import javax.swing.border.Border;
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      class TestDialog extends JDialog {

        JPanel mainPanel = new JPanel();
        JPanel topPanel = new JPanel();
        JPanel bottomPanel = new JPanel();
        JButton okButton = new JButton();
        JButton cancelButton = new JButton();
        JComboBox combo = new JComboBox();
        JRadioButton radio1 = new JRadioButton();
        JRadioButton radio2 = new JRadioButton();


        BorderLayout borderLayout1 = new BorderLayout();


        javax.swing.JTextField textField = null;
        javax.swing.ButtonGroup group = new javax.swing.ButtonGroup();

        public TestDialog() {
           try {

              setTitle("Test Dialog");
              jbInit();
              //pack();

              this.setSize(300, 200);
              this.setResizable(false);
              this.setLocation(300, 300);
              show();

            }
            catch(Exception e) {
              e.printStackTrace();
            }
          }

        public static void main(String[] args) {
          try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          }
          catch(Exception e)
          {
            e.printStackTrace();
          }

          TestDialog dialog = new TestDialog();
          dialog.show();

        }

        private void jbInit() throws Exception {

          mainPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(20,20,20,20));
          mainPanel.setLayout(borderLayout1);

          topPanel.setLayout(new javax.swing.BoxLayout(topPanel, javax.swing.BoxLayout.Y_AXIS));

          combo.setMaximumSize(new Dimension(300, 21));
          combo.setAlignmentX((float) 0.0);
          radio1.setText("radio1");
          radio2.setText("radio2");

          group.add(radio1);
          group.add(radio2);

          bottomPanel.setAlignmentX((float) 0.0);
          okButton.setText("OK");
          okButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e)
            {
              System.out.println("Ok button Pressed");
            }
          });

          cancelButton.setText("Cancel");
          cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e)
            {
              System.out.println("Cancel button Pressed");
            }
          });

          topPanel.add(combo, null);
          topPanel.add(radio1, null);
          topPanel.add(radio2, null);
          bottomPanel.add(okButton, null);
          bottomPanel.add(cancelButton, null);

          mainPanel.add(topPanel, BorderLayout.CENTER);
          mainPanel.add(bottomPanel, BorderLayout.SOUTH);

          getContentPane().add(mainPanel, BorderLayout.CENTER);

        }
      }

            svioletsunw Scott Violet (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: