Bug #5587

long parameter values get replaced with scrollbar

Added by Daniel Crawl over 10 years ago. Updated about 10 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


In the actor parameters dialog, if a parameter value has more characters than can fit in the text box, the text box is replaced with a scrollbar.

scrollbar.png (41.5 KB) scrollbar.png Daniel Crawl, 06/11/2012 10:38 AM


#1 Updated by Christopher Brooks over 10 years ago

I'm not sure what the bug is here, could you post a screenshot and/or a detailed description of how to replicate the issue?

#2 Updated by Daniel Crawl over 10 years ago

To reproduce:

1. add actor to canvas
2. double click on actor to open actor parameters dialog
3. in one of the parameter value text boxes, insert characters until there's too many to fit in the box

#4 Updated by Daniel Crawl over 10 years ago

I just checked, and this is still a problem. I added a screen shot.

#5 Updated by Daniel Crawl over 10 years ago

Patricia fixed in r63735.

#6 Updated by Daniel Crawl about 10 years ago

I'm reopening since this is occurring again. The steps in comment 2 will demonstrate the problem. I verified again that r63735 fixed the problem, so the regression has happened since then.

#7 Updated by Christopher Brooks about 10 years ago

The problem is that JTextArea should not be used when there is just a single
line and no scroll bar.
"If you need to obtain only one line of input from the user, you should use a text field."

It seems like part of the problem is that the JTextArea gets a scrollbar and wants more screen real estate, but the GridBagLayout in ptolemy.gui.Query
is not giving it space.

I'll look into this, but I'm not confident.

#8 Updated by Christopher Brooks about 10 years ago

This is fixed.
I added code to Query:

protected static void _textAreaSetRowsAndRepackParent(JTextArea textArea,
int minimumNumberOfRows) {
// This method is based on code by Patricia Derler that was
// originally in PtolemyQuery.
// One test for this is to drag in a StringConst and type in              
// lots of characters. You should get a scrollbar. See
if (textArea.getRows() < minimumNumberOfRows) {
textArea.setRows(textArea.getRows() + 1);
Component parent = textArea.getParent();
while ((parent != null) && !(parent instanceof ComponentDialog)) {
parent = parent.getParent();
if (parent instanceof ComponentDialog) {
ComponentDialog dialog = (ComponentDialog) parent;

This is based on code by Patricia that was in PtolemyQuery.
Now PtolemyQuery calls this method as well.

#9 Updated by Redmine Admin over 9 years ago

Original Bugzilla ID was 5587

Also available in: Atom PDF