JDK-4256485 : JOptionPane.showInputDialog does not correctly set height
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1999-07-22
  • Updated: 1999-10-05
  • Resolved: 1999-10-05
Related Reports
Duplicate :  
Description
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) 
======================================================================

Comments
WORK AROUND Name: skT88420 Date: 07/22/99 Only work around I've been able to do is to create my own JDialog and implement the necessary listeners. ======================================================================
11-06-2004

EVALUATION This seems to be a dup of 4222531. amy.fowler@Eng 1999-10-04
04-10-1999