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

JOptionPane.showInputDialog does not correctly set height

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.2
    • client-libs



      Name: skT88420 Date: 07/22/99


      This worked in previous versions. I noticed JOptionPane.showInputDialog broke an application of mine that uses a custom multiline label that auto word-wraps. I've tested the same dialog with the new multiline HTML labels in JDK 1.2.2 and with multiple single labels.. it seems if there is more than a single line of text in the dialog, it does not size correctly, and the buttons are cut off. This is on Windows NT, 98, and 95. I have not yet tested the Solaris implementation.

      Sample Code:

      package net.laureate.ease.test;

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class TestFrame extends JFrame {

        //Construct the frame
        BorderLayout borderLayout1 = new BorderLayout();

        public TestFrame() {
          enableEvents(AWTEvent.WINDOW_EVENT_MASK);
          try {
            jbInit();
          }
          catch (Exception e) {
            e.printStackTrace();
          }
        }
      //Component initialization

        private void jbInit() throws Exception {
          this.getContentPane().setLayout(borderLayout1);
          this.setSize(new Dimension(400, 300));
          this.setTitle("Test");

      // JLabel label = new JLabel(
          Object response = JOptionPane.showInputDialog(this,
            new String[] {
             "This is a test",
             "of the JOptionPane popup",
             "dialog: showInputDialog."
            }, "Insert Timepoint", JOptionPane.QUESTION_MESSAGE,
            null, new String[] {"Option1", "Option2"}, "Option1");


        }
      //Overriden so we can exit on System Close
        
        protected void processWindowEvent(WindowEvent e) {
          super.processWindowEvent(e);
          if (e.getID() == WindowEvent.WINDOW_CLOSING) {
            System.exit(0);
          }
        }
      }

      package net.laureate.ease.test;

      import javax.swing.UIManager;

      public class TestApplication {
        boolean packFrame = false;

        //Construct the application

        public TestApplication() {
          TestFrame frame = new TestFrame();
          if (packFrame)
            frame.pack();
          else
            frame.validate();
          frame.setVisible(true);
        }

        public static void main(String[] args) {
          new TestApplication();
        }
      }

      java -version
      java version "1.2.2"
      HotSpot VM (1.0fcs, mixed mode, build E)

      java -fullversion
      java full version "JDK-1.2.2-W"
      (Review ID: 88287)
      ======================================================================

            amfowler Anne Fowler (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: