bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22980] swing: JOptionPane.showInputDialog does not show m


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22980] swing: JOptionPane.showInputDialog does not show multiple lines
Date: 16 Oct 2005 01:27:51 -0000

Steps to reproduce:
1. Run the attached testcase

Expected results:
1. A window with "line1", "line2" and "line3" shows up.

Actual results:
1. A window shows up but "line2" and "line3" are not visible.

Testcase:
import javax.swing.*;
public class inputdialog extends JFrame {
        public static void main(String[] args) {
                (new inputdialog()).show();
        }
        public inputdialog() {
                JOptionPane.showInputDialog("line1
line2
line3");
        }
}


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-06-20 
13:49 -------
I emailed the following patch to classpath-patches on June 17, 2005.

Index: javax/swing/SwingUtilities.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/SwingUtilities.java,v
retrieving revision 1.30
diff -u -r1.30 SwingUtilities.java
--- javax/swing/SwingUtilities.java     3 Jun 2005 11:55:28 -0000       1.30
+++ javax/swing/SwingUtilities.java     17 Jun 2005 18:36:42 -0000
@@ -848,8 +848,14 @@
       }
     else
       {
+        int fromIndex = 0;
         textR.width = fm.stringWidth(text);
         textR.height = fm.getHeight(); 
+        while (text.indexOf('\n', fromIndex) != -1)
+          {
+            textR.height += fm.getHeight();
+            fromIndex=text.indexOf('\n', fromIndex)+1;
+          }
       }

     // Work out the position of text and icon, assuming the top-left coord


------- Comment #2 from from-classpath at savannah dot gnu dot org  2005-06-24 
09:15 -------
I can see all lines now, thanks.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22980





reply via email to

[Prev in Thread] Current Thread [Next in Thread]