changeset 18611:56209bab4213 gui-release

Update java dialog box to support scrolling (bug #41476). JdialogBox.java: Instantiate a scrollpane and put list inside scrollpane. contributors.in: Add Colin Foster to list of contributors.
author Colin Foster <fostercl1+octave@gmail.com>
date Tue, 18 Feb 2014 17:35:08 -0600
parents ebd063b7b1c6
children 89b7bd7d0b83
files doc/interpreter/contributors.in scripts/java/org/octave/JDialogBox.java
diffstat 2 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/contributors.in	Thu Mar 20 12:28:53 2014 -0400
+++ b/doc/interpreter/contributors.in	Tue Feb 18 17:35:08 2014 -0600
@@ -72,6 +72,7 @@
 Stephen Fegan
 Ramon Garcia Fernandez
 Torsten Finke
+Colin Foster
 Jose Daniel Munoz Frias
 Brad Froehle
 Castor Fu
--- a/scripts/java/org/octave/JDialogBox.java	Thu Mar 20 12:28:53 2014 -0400
+++ b/scripts/java/org/octave/JDialogBox.java	Tue Feb 18 17:35:08 2014 -0600
@@ -1,5 +1,6 @@
 /*
 
+Copyright (C) 2014 Colin Foster
 Copyright (C) 2010, 2013 Martin Hepperle
 
 This file is part of Octave.
@@ -551,24 +552,28 @@
           {
             lst[i] = theTranslator.replace (list[i]);
           }
+
+        JScrollPane scrollPane = new JScrollPane();
         m_List = new JList (lst);
+        scrollPane.setViewportView(m_List);
+
 
         // replace ugly monospaced font
-        m_List.setFont (p.getFont ());
+        scrollPane.setFont (p.getFont ());
 
-        m_List.setMinimumSize (new Dimension (Math.max (1,
-                                                        Integer.parseInt (RowsCols[0].toString ())),
-                                              Math.max (1,
-                                                        Integer.parseInt (RowsCols[1].toString ()))));
-        m_List.setPreferredSize (new Dimension (Math.max (1,
-                                                          Integer.parseInt (RowsCols[1].toString ())),
-                                                Math.max (1,
-                                                          Integer.parseInt (RowsCols[0].toString ()))));
-        m_List.setBorder (new javax.swing.border.EtchedBorder ());
+        scrollPane.setMinimumSize (
+          new Dimension (
+            Math.max (1, Integer.parseInt (RowsCols[0].toString ())),
+            Math.max (1, Integer.parseInt (RowsCols[1].toString ()))));
+        scrollPane.setPreferredSize (
+          new Dimension (
+            Math.max (1, Integer.parseInt (RowsCols[1].toString ())),
+            Math.max (1, Integer.parseInt (RowsCols[0].toString ()))));
+        scrollPane.setBorder (new javax.swing.border.EtchedBorder ());
 
         gbc.gridy = message.length;
         gbc.fill = GridBagConstraints.HORIZONTAL;
-        p.add (m_List, gbc);
+        p.add (scrollPane, gbc);
 
         if (on.toLowerCase ().equals ("single"))
           {